Sum Depending On Other Columns

May 15, 2007

I want to create a macro that make the somme of 2 other columns when the nummer of the first column ist double(more than one ) and put the somme in a new Rows. like this :

A C
23 5
23 12
23 2
45 4
45 1
46 3

in the news the resultat in the same columns it´s like this
A C
23 19
45 5
46 3

I got this code , but I work only for news colums , A and B


Sub test()
Dim a, i As Long, b(), n As Long
a = ActiveSheet. Range("a1"). CurrentRegion.Resize(, 2).Value
Redim b(1 To UBound(a, 1), 1 To 2)
With CreateObject("Scripting.Dictionary")
.CompareMode = vbBinaryCompare
For i = 1 To UBound(a, 1)
If Not .exists(a(i, 1)) Then
n = n + 1: b(n, 1) = a(i, 1)
.Add a(i, 1), n
End If
b(.Item(a(i, 1)), 2) = Val(b(.Item(a(i, 1)), 2)) + Val(a(i, 2))
Next
End With
ActiveSheet.Range("d1").Resize(n, 2).Value = b
End Sub

View 9 Replies


ADVERTISEMENT

List To Display Value Depending On Certain Columns

Apr 24, 2013

I am developing a workbook, one part of the book is to track discipline I have a page for this and a userform on the front page to enter data into it. I would like if you will a summary box (list box or whatever is best) displayed on the front page and I would like a line to appear in that box maybe saying john smith requires a warning. I need this to appear if john smith has been entered 3 times into the name column on the discipline sheet however only if the offence is the same 3 times for example 3 lates not 2 lates and 1 non attendance.

After it displays this line in the summary box I would like to be able to double click it where a small userform appears where a user can then select discipline received or something and for this lien to disappear in the summary and all 3 entries in the discipline sheet.

View 9 Replies View Related

Summe Column Depending Of Other Columns

May 15, 2007

I want to create a macro that make the somme of 2 other columns when the nummer of the first column ist double(more than one ) and put the somme in a new Rows. like this :

A B
23 5
23 12
23 2
45 4
45 1
46 3 in the news the resultat in the same columns it´s like this
A B
23 19
45 5
46 3

View 10 Replies View Related

Add (every 3rd Or 4th Depending On Content) Rows Into Columns

May 21, 2012

I have a set of data all in clumn A - I want to sort into into rows - "Name", "Manage" or "Send Message", "Job title/Company" and "Country", but some are missing "Country" (therefore, some entries have 3 rows and other have 4.

The differentiator is that every name is repeated within the cell, whereas no other row is repeated. Any macro to get all these into 4 columns?

Example:

Steve Wonder Steve Wonder
Manage General Manager in ZXY games United States Jake Gave Jake Gave
Send message VP Business Development in XYH Games
Russia Carter Jonas Carter Jonas Send message in 148G
Clement Galiay Clement Galiay

View 9 Replies View Related

Sort Rows Depending On Value In Only One Of Columns

Aug 16, 2012

I wish to sort all of my rows depending on the value in only one of the columns. I do not know how to set this up, my data starts in row 7 and is in columns B:F, needs to be sorted by descending in column B.

View 1 Replies View Related

Group / Ungroup Columns Depending On Value?

Oct 18, 2013

I have a ton of worksheets that I maintain for Budget, LE, LE2, LE3. Every time we complete a Budget I need to group the LE Columns, and once we complete an LE, the budget column needs to be grouped and LE column ungrouped. So twice a year I need to make these changes. It is quite cumber some to change this for multiple tabs.

I already have a technical worksheet to dynamically change the date, naming etc. I want to be able to add a cell that will either read 200 (budget), or 300 (LE). Depending on what his cell reads, I want to group and ungroup their respective columns.

View 2 Replies View Related

Copy Columns Depending On Criteria

Dec 6, 2007

I have attached a spreadsheet.

I have a dump of about 4000 calls (I have minimised the attachment for size sake) that I need to do certain reports on.

The second sheet (dump) has the data in its raw form from our call reporting tool. The 1st sheet (Report) is a broken down version the powers that be wish to see.

My formula needs to meet certain criteria, as you can see I only have 6 columns on the (Report) sheet where as the dump has lots !

The (report) sheet needs to list the Parent Case ID only if the Summary column has BSR at the beginning, if it meets this criteria then it lists the other relevant columns in the (report) sheet.

View 5 Replies View Related

Delete Columns Depending On Number Of Rows

Jun 5, 2014

I have a workbook, with a worksheet "Summary". In this worksheet "Summary" I would like to delete all columns that have less than 100 rows.

Please see the attached file : Summary.xlsx‎

View 3 Replies View Related

Hide/unhide Columns Depending On Criteria

Jan 11, 2010

I am trying to hide or unhide columns E:BL depending if the the cell value in row 54 contains a value (Note cells in row 54 contain formulas). I have written the following code but get a runtime error on the else statement.

Sub UpdateCashflow()
Application. ScreenUpdating = False
ActiveSheet. Unprotect Password:="LD"
ActiveSheet.Select
Dim c As Integer
For c = 5 To 64
If Cells(54, c) = "" Then
ActiveSheet.Range(Cells(54, c)).EntireColumn.Hidden = True
Else
ActiveSheet.Range(Cells(54, c)).EntireColumn.Hidden = False
End If

Next c

ActiveSheet.Protect Password:="LD", DrawingObjects:=True, Contents:=True, Scenarios:=True
Application.EnableEvents = True
'
End Sub

View 4 Replies View Related

Repeat Cells In Column Depending On Change In Another Columns

Jan 23, 2013

Here is an example list:

Networks
Hardware
Networks
Software
Networks
Resources
Apps
Hardware
Apps
Software
Apps
Resources
Domain
Hardware
Domain
Software
Domain
Resources
Print
Hardware
Print
Print

All I'm trying to do in the second column is something that can say if there is a change in column A, then restart the order, or not..

View 9 Replies View Related

Array Of Columns / SUMIF A Particular Column / Depending On A Certain Criteria

Jul 24, 2014

I have a download from an accounting general ledger which has the following:

Column A: Category Description
Column B: Country
Column C: Department
Row 1: Months
Note: Each row contains the last 12 months worth of costs

As the categories/criteria can appear multiple times, and there are thousands of lines, I have been using SUMIFS to calculate totals my required combinations (eg. Travel expense, Germany, Sales department)

Every month, the information refreshes to show the most recent 12 months worth of data. And this means I need to manually update my formulas to correct the month column headings, as everything moves by 1 month.

Would something like a SUMIF with a SUMPRODUCT work? Eg. if current month = July, then it would sum everything from the July column automatically?

View 4 Replies View Related

Conditional Formatting: Format 3 Columns Depending On Certain Value From Another Column

Mar 26, 2009

I want to format 3 columns in excel depending on certain value from another column.
By example: I have the columns A B C completed with some text. On the column D it will be the numbers 0 or 1. If the number is 0 the background color from A,B,C columns shall be Green, if the number is 1 the color shall be red.

I have tried in conditional formatting with the formula =$D$1=0 but the color of the columns are changing only depending on the value from cell D1. I don't know what is the correct formula. For column A1 I want to check the value from D1, A2 - D2, A3 - D3,...,An - Dn.

View 2 Replies View Related

Hide/Unhide Columns Depending On A Specific Cell Value

Jul 13, 2009

I am looking or a code, (Or formula if one exists) to hide or un-hide columns depending on what is entered into a cell. I have attached an example to help clarify what i mean. Basically i want:

If A2 is empty, hide columns C, D, E & F
If A2 = Apple, Unhide columns C & D, but keep E & F hidden
If A2 then becomes Banana, rehide C & D and unhide D&F

View 2 Replies View Related

Numbering Cell Columns Depending On Other Cell Columns Data

Oct 15, 2011

I would like to know if there is a vba code doing this I have eg 100 columns starting from the column B. At the first 3 rows there are some data. Now im using the data from the rows 2 and 3. The row 2 has column numbers (TEXT formatted) from the user. The numbers starts from the 01 and goes on. But it mights be more columns numbered with the 01 or 02 or 03 or.. The row 3 has consecutive numbers and stars. The numbers start from the 1 and stop when the row 2 changes the number. The star appears when the user insert a new column (to the following example are the columns J, K, L &M )

B----C-----D-----E----F-----G-----H-----I------J-----K------L-----M---
null null ....
01---01---01----02---02----03----03----03----03----04-----04----05---
1----2-----3-----1----2-----1------2-----3-----4------*-----*----*----

I want a vba code that it has to look for the stars and then to change them to consecutive numbers depending on the above row. So, the previous exmample it would be after running the code like this.

B----C-----D-----E----F-----G-----H-----I------J-----K------L-----M---
null null ....
01---01---01----02---02----03----03----03----03----04-----04----05---
1----2-----3-----1----2-----1------2-----3-----4-----1------2-----1----

View 7 Replies View Related

Excel 2010 :: Convert Multiple Columns To Rows Depending On Input Value

Jul 6, 2014

I have lot of data in Excel 2010 which I wish to bring in Columns using a Macro depending on the input value which the macro should prompt me. For E.g.:

A1B1C1D1E1F1G1H1I1J1
12345678910
12345678910
12345678910
12345678910
12345678910

If I select data from A1 and J1 (in practical it will be more Columns) the Macro should prompt me how many Columns would be the output on Master Sheet. If the input is 2 then it should create an output Sheet "Master" and should show the following result

A1B1
12
12
12
12
12
34
34
34
34
34
56
56
56
56
56
.. ..
.. ..

It after selection I run the macro and input 3 then the output should go in three columns (A1,B1,C1) one below other. If 4 is Input then 4 Columns (A1,B1,C1,D1) will come below each other so on and so forth.

View 6 Replies View Related

Moving Data From Rows To Columns - Depending On Unique Content In A Field In Column

Jun 24, 2014

I have a worksheet which contains 2 columns which is needed to work my problem.

Unique Work ID and Description

The unique work ID are the same for each description, but there are up to 5 different description associated with each unique work id.

I'm looking for an automated process but where to start to convert the 5 rows in the unique row and 5 column for the descriptions

View 8 Replies View Related

Insert Formula Depending On Cells Depending Of Variables?

Jan 27, 2014

In a macro I want to automatically insert a formula in several cells. The formula depends on other cells, and I want to be able to manipulate these cells with variables. Here is my code:

[Code] .....

All my variables are declared:

Sheets("DATOS YTD 2014").Cells(I, Semana + 1) is the cell I want to be able to chose due to the variables
Sheets("DATOS YTD 2014").Cells(I, 3) is the reference cell for the VLOOKUP formula, that will vary with I
SheetMonth.Range("B3:W172") is a range in the sheet SheetMonth which is fixed

The error message I receive is the following: "Run-time error 13, Type mismatch"

I precise that the next step is to make the ",6," part in the vlookup formula also variable... but I guess once my current issue is solved this one will be a piece of cake.

View 3 Replies View Related

Redirecting Multiple Columns From One Sheet To Another Sheet Depending On A Condition?

Jan 23, 2014

In sheet 1 i have the data like this

Date Amount
---------------------------
13-Mar-13
---------------------------
20-Mar-13 2000
---------------------------
27-Mar-13
---------------------------

[code]...

now in sheet 2 i need the date and amount fields in which amount is present.

i need sheet 2 like this

Date Amount
-----------------------------
20-Mar-13 2000
-----------------------------
3-Apr-13 3000

2.jpg

View 2 Replies View Related

Menu Available Depending On Yes Or No?

Dec 5, 2013

Can I make a drop down list only available if another cell contains a Yes.

example :

A1 has a Yes/No drop down list by data validation

If A1 = yes then B1 gives the option of another Yes/no drop down list. If A1=No, or blank, then B1 has no menu option.

View 12 Replies View Related

Getting Value Depending On Changes Of 2 Cells

Jul 10, 2014

I have an issue with this for a couple of days actually..

I have to find in a certain date "column C" if User "column D" changes from the initial user's number to another one to gave me the first half sales of the day and then obtain the other sales of the other part, this must reestart again when the date changes.

I have to know what was the sales on the two parts of the day and then in column Q assign "Manana", S1 Cell or R1 Cell for second part of day

The User "column D", can be diferent each day.

I attach the excel data to get a better explanation on this.

Mov may-jul FARMAX.xlsx

View 7 Replies View Related

IF Command: Depending On This Value

May 21, 2009

I have a sheet in which I have a sum then depending on this value I want the next cell, F4, to have one of four outputs

If the value in F3 is;
Less than 1 F4 should show 9
between 1 and 2 F3 should show 16
Between 2 and 3 F3 should show 25
Greater than 3 F3 should show 36.

I have used IF to get the correct result when F3 is less than one but cannot work out how to add the other three results.

View 3 Replies View Related

Formula Depending On A Value

Mar 2, 2010

i have a sheet which is being used as a payment advise with subsidies.
depending on the product selected, it is either a $value multiplied by the qty or a % of the total value.

what i am trying to do as an example:

if cell F46 = percent(or sheet2 b6) it needs to multiply by cell H32

BUT if cell F46 = $ (or sheet2 B7:B11) it needs to multiply by cell B46

(sheet 2 has named ranges to be used in a list box)

View 9 Replies View Related

Cell That Changes Depending On Month

Mar 4, 2009

I'm trying to get the pink cell in THIS sheet to match up with the correct MONTH'S TOTAL in the pink highlighted column in THIS sheet. i couldnt figure out how to explain it any clearer.

View 6 Replies View Related

Row Color Depending On Cell Value

Sep 3, 2009

I was wondering if it is possible to fill a row with a color depending on the value of a certain cell. Say, if the value of cell N5 is 0 then row 5 turns red.

View 3 Replies View Related

Summing YTD Depending On Month?

Oct 1, 2009

I have a spreadsheet with a year’s worth of data in. The columns are months (Jan, Feb, Mar etc) and the rows are people (A, B, C etc). There is a YTD column at the right.

I will be updating a cell at the top with the current month.

I want to be able to sum the YTD figures depending upon the date at the top. For example, the date at the top is Aug, so I want to sum Jan to Aug, if I change the date to Sep then I want to sum Jan to Sept. This way I will be able to automatically calculate YTD on a pre-populated spreadsheet, just by changing the date each month.

View 5 Replies View Related

Ranking Depending On Several Factors?

Dec 7, 2012

I have to make a hierarchy of my employees, taking in consideration the achievemnt of their target. I'll attach a sample to make it simple to understand. The are 2 classes of factors: Class I and Class II.

- In Class I (witch counts 75% in total results) there are:
- New deposit - count 75% from class I
- Insurance - count 10% from class I
- Investments fund - count 15% from class I
- In Class II (witch counts 25% in total results) trere are:
- Loan A - count 15% from class II, but the number have a weight of 40% in results, and volume 60%
- Loan B - count 75% from class II, but the number have a weight of 75%, while volume have 25%
- New clients - count 10% from class II

Now, I have to rank the employees taking in consideration the Deviation for all of the factors above (columns E, H, K, P, Q, V, W, Z).

View 3 Replies View Related

Use Same VBA Macro Depending On Cell Name

Jan 30, 2014

[Code] .....

But what I want to do now is to strikethrough to eliminate unwanted data when a particular option is selected from the drop down list. In this case ( If User choose "Mens" for Gender, and NOT "Pants", Then Strike though the Result "NIKE". This works for the template in column E only using this code.

[Code] ...............

I tried to modify this like

[Code] ...............

So that every time x changes, the condition changes, but it seems like I cant do, Range("NIKE_" & x).

Attached File : Test1-2ed.xlsm

View 2 Replies View Related

Add Data To Row Depending On Combobox?

Feb 21, 2014

Basically I have a column filled with names (A) that the combobox is filled with, I then have a text based inputbox and a submit button. Right now the submit button transfers the data from the inputbox to the same row depending on the combobox choice and edits the existing text which is fine.

However I also want the data to be submitted to another sheet where the data is not edited but added.

Example: I choose James from combobox and writes 10 in the inputbox, the submit button will then edit the existing value on the "Data Edit" sheet on the row James and add the value to the row James on the "Data Add sheet".

This is the edit code, I basically just need some pointers as to how to add data to blank cells in corresponding rows according to combobox selection.

[Code] .....

Attached File : Combobox Row Add.xls‎

View 4 Replies View Related

Hide Row Depending On Cell Value?

Mar 24, 2014

I would like to run a macro that searches column [AS] and hides any rows in that column that contain "0".

View 6 Replies View Related

Separating The Records Depending On The Value

Dec 22, 2008

I have attached 2 spreadsheet :-

1. BounceBackMaster.xls
2. BouncebackMails.xls

I need to excute the macro from master file asking the input file. Input file will be the Mails spreadsheet. In the master spreadsheet there will be "TAG" column, depending on value it need to check the value in the Mails spreadsheet "MessageContent" column after subject value. It need to group all tAG value, each sheet need to be created with TAG value and related need to be copied from "BounceBack" sheet to created sheet.

Example:

Step 1 :- Macro is executed from "BounceBackMaster.xls" and asked for input file, input file will be "BouncebackMails.xls"

Step 2 :- From "BounceBackMaster.xls", First TAG value will be readed " Monthly Account Statement" is check in "BouncebackMails.xls"........

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved