Forum Discussion
Combining data when removing duplicates
Morning forum,
I'm looking for some help with removing duplicates in excel, I'd like to know if there is a way to sum total particular fields of data as duplicates are removed?
For example, I'd like the sum of the contents of Column B when removing duplicates displayed in column A.
Turning this....
| A | B |
| 31506090000875 | 1.75 |
| 31506090000875 | 1.75 |
| 31506090000875 | 1.75 |
| 31506090000877 | 2.81 |
| 31506090000877 | 2.81 |
| 31506090000877 | 2.81 |
Into this....
| A | B |
| 31506090000875 | 5.25 |
| 31506090000877 | 8.43 |
Any help or advice would be most appreciated 🙂
7 Replies
- Harun24HRBronze Contributor
Another approach using GROUPBY() and trimrange feature referencing full column.
=GROUPBY(DROP(B.:.B,1),DROP(C.:.C,1),SUM,,0) =GROUPBY(B2.:.B12,C2.:.C12,SUM,,0) - PeterBartholomew1Silver Contributor
Modern Excel has so many alternatives and, as yet, little guidance concerning best practice.
= SUMIFS(value,ref,UNIQUE(ref))but a whole spectrum of variations is possible, including,
= MAP(UNIQUE(ref), Sumifλ(value,ref)) where "Sumifλ" is given by = LAMBDA(v₀,r₀, LAMBDA(d, SUM(FILTER(v₀, r₀=d))))The purpose of the two Lambdas is to allow the sum and criterion ranges to be passed as a parameter string whilst each unique ref is passed one at a time by the MAP helper function.
- Isadora94Copper Contributor
Hi! How are you?
I need the exact same thing, but instead of numbers there's only text.
The file has over 120 k lines and thousands of duplicates. The column A has the ID for some genetic mutations, column B has the specific trait for that mutation and column C has the bigger trait. So I have duplicates for the ID's and traits, and I would like to remove the ID duplicates, but combining the data related to it, all in one line.
Do you think you can help me?
- Starrysky1988Iron Contributor
- SergeiBaklanDiamond Contributor
As variant
=LET( ref, INDEX(data,,1), value, INDEX(data,,2), u, UNIQUE(ref), total, MMULT(SEQUENCE(,ROWS(data),1,0), --(ref=TRANSPOSE(u) )*value ), IF({1,0}, u, TRANSPOSE(total))) - harshulzIron Contributor
LeeBrennan Hi,
i am with riny, because it is easiest and hassle free way
but i have also prepared formulation attached file - Riny_van_EekelenPlatinum Contributor