I have an Excel table whose unique key is the combination of Para1, Para2 and Para3:
Para1 Para2 Para3 Value1 Value2 Value3
A B C 1 2 3
A E F 4 6 4
A B C 5 3 7
P Q R 4 2 4
I want to find the duplicates and SUM the values, so the expected output is:
Para1 Para2 Para3 Value1 Value2 Value3
A B C 6 5 10
A E F 4 6 4
P Q R 4 2 4
Is there a way to group the data get the SUM?
You could copy the columns 1,2 & 3. Then remove the duplicates and put a SUMIFS function in the Value columns.
Assuming Para1 is in A1, insert a column on the left that concatenates the key elements:
=B1&C1&D1
and copy down to suit. Sort your data by that column and apply Subtotal At each change in: Para1Para2Para3, Use function: Sum, Add subtotal to: check Value1, Value2, Value3, Replace current subtotals and Summary below data, OK.
Filter ColumnA, Text Filters, Contains..., tot, OK. In B4 enter:
=B3
copy across to D4 and B4:D4 down to suit. (Select All) in ColumnA, select all cells, Copy, Paste Special..., Values, OK over the top. Filter ColumnA again to select Does Not Contain..., tot, OK and delete all visible except the labels. Delete ColumnA and last row. Select all cells and in Subtotal select Remove All.
Related
I have a data set that looks something like this-
Item
Value
A
1
A
2
A
3
B
1
B
2
B
3
C
1
C
2
And I want to convert it to this -
Item
Value
A
1,2,3
B
1,2,3
C
1,2
Using your provided example data, and assuming a data setup like this:
In cell D2 and copied down is this formula to get unique items: =INDEX($A$2:$A$9,MATCH(0,COUNTIF(D$1:D1,$A$2:$A$9),0))
In cell E2 and copied down is this formula to get the joined values: =TEXTJOIN(",",TRUE,REPT($B$2:$B$9,$A$2:$A$9=D2))
Adjust the ranges to suit your actual data.
I have in excel something like:
A B
1 Value1 10
2 Value2 20
3 Value1 5
4 Value1 10
5 Value2 15
How I can sum for given value in A? For example, having something like this:
6 C D
7 Value1 25 (sum of b1+b3+b4)
8 Value2 35 (sum of b2+b5)
Of course, how can I do this automatically and not manually.
Thanks very much.
Let's assume you have a list of the unique values in column A listed in column C, i.e.:
Row A B C
1 Value1 10 Value1
2 Value2 20 Value2
3 Value1 5
4 Value1 10
5 Value2 15
In column D, the following formula will count the occurences of each value in column C:
=SUMIF(A$2:A$6, "=" & $C2, B$2:B$6)
This should be pasted into D2 and then copied to D3, D4, etc.
The result will look like:
Row A B C D
1 Value1 10 Value1 25
2 Value2 20 Value2 35
3 Value1 5
4 Value1 10
5 Value2 15
How does this work? SUMIF allows criteria to be used, and if satisfied, a SUM of the cells is taken. In this case, the SUMIF does this:
Looks in cell range A$2:A$6
Compares the value in each cell to see if it is equal to $C2 (or $C3, etc dependent upon which row is being calculated)
If it is equal, sum the value from the cell range B$2:B$6
Limitations
In order for this to work, the unique values in column A must already be known and listed in column C. There are some ways of generating a list of unique values but they are not straight-forward. Roll on UNIQUE which ships with the new version of Office.
There are different ways to do this:
Use a pivot table (as already mentioned in the comments).
Use a SumIf() worksheet function (as mentioned in another answer). This, however, will only work if you know all names (like Value1, Value2, ... (the list MUST be limited))
Use subtotals. This, however, will only work when you sort first.
Write a VBA macro.
I have this problem as noted below:
Column A = Part number
Column B = Quantity
Column C = Part number
Column D = Quantity
Using conditional formatting, I would like to highlight if the combination of Part number and Quantity in Column A and B is different to the combination of Part number and Quantity in Column C and D.
Eg:
Col A Col B Col C Col D
1 1111 2 1112 5
2 1112 3 1111 2
3 1131 5 1112 5
4 1122 3 1131 2
To do this, I'd like to set up a couple of 'helper' columns (say E & F) by concatenating Column A & B, C & D.
So essentially, I'd like to take the information from the helper columns E & F, but use conditional formatting to highlight the cell in column B and D.
From the example above, cell B3 and D4 would be highlighted.
Is this possible, and if not, is there are simple alternative? (I don't mind using a macro if need be).
I would use COUNTIFS
For B1:B4
=COUNTIFS($C$1:$C$4,A1,$D$1:$D$4,"<>"&B1)
and for D1:D4
=COUNTIFS($A$1:$A$4,C1,$B$1:$B$4,"<>"&D1)
In case you even want to skip the helper columns, you could format A1 with =$A1&$B1<>$C1&$D1 and copy the format to any cells in you want to be highlighted (even to your helper columns).
I'm not so advanced in excel I need help if is it possible to do.
I have an excel with this column:
ID - Value1 - Value2
I need to update the value1 (or value2):
- only if are blank AND only if the row has the same ID
I make an example, I have this table:
ID Value1 Value2
A1 1 100
A2 2
A3 3
A4 1 200
A5 2 250
Iwould like to fill all the empty cell in this way
ID Value1 Value2
A1 1 100 200
A2 2 250
A3 3
A4 1 100 200
A5 2 250
Thank you for any help.
Ok, so your data is a mixture of numbers and texts. You can generate two new columns with the desired values using formulas. Choose two new, adjacent columns, say D and E, and enter this CSE formula in row say in cell D2:
D2:
=IFERROR(IF(ISBLANK(B2),INDEX(B$2:B$99,
MATCH(1,($A$2:$A$99=$A2)*(1-ISBLANK(B$2:B$99)),0)),B2), "")
CtrlShiftEnter
Enter the formula in D2 with CtrlShiftEnter and then copy/paste in the cells of columns D and E (or as I said any two adjacent columns).
I've an excel with 2 sheets, the sheet 2 has some KV, my requirement is that, when I enter a key in sheet 1, it should get the corresponding values (spread across many columns & rows).
Sheet2:
A B C D
1 Obj1 Item1 Price1 Qty1
2 Item2 Price2 Qty2
3 Item3 Price3 Qty3
4 Item4 Price4 Qty4
Note: Obj1 is merged for 4 rows in col1.
In Sheet1 if I enter Obj1, I want all the values present in column B, C, D & the rows 1, 2, 3, 4.
I tried the option
{=vlookup("Obj1", Sheet2!A:D, {2,3,4}, false)}
But does not return 3 columns as expected. (I read this method of returning multiple columns in some website)
Kindly help me to resolve this.
Use a helper column:
In E1 put:
=A1
In E2 put
=IF(A2<>"",A2,E1)
Then put this formula in the upper left corner of the desired output range:
=IFERROR(INDEX(B$1:B$4,AGGREGATE(15,6,ROW(B$1:B$4)/($E$1:$E$4=$G$1),ROW(1:1))),"")
Where $G$1 is the location of the Search Criteria.
Then drag/fill this formula across a total of three columns and down enough rows to cover the greatest number of rows that a object can have.
Of course once you have your helper column you can easily use it with filters to output the same thing without the formulas.