Sum only the unique values from one column within a range of duplicate values from another column

ma2169

New Member
Joined
May 10, 2023
Messages
6
Office Version
  1. 2016
Platform
  1. Windows
I am using Excel 365. I have looked and tried for hours but have been unable to come up with a good formula.

I have a worksheet with multiple columns. I need to write a formula (not a macro) in a 3rd column that sums only the unique values in column G but only for the rows that have duplicate values in column B. I have plenty of room for helper columns if needed. The formula should give one result for each unique ID number

I tried in an empty column T
=unique(B2:B1000)

then in Column U
=SUMIF(B2:B6,T2#,G2:G1000)

But this sums all instances where the ID is duplicated. I only want it to sum the unique values from columns G

So for example in the chart below.

The formula result for ID 18959 would be 4 as it would sum row 1 and row 3 because those are unique values within the duplicated range of ID 18959.
Similarly for ID 18960 the response would be 6 because that is the only unique value for that ID.

In my sheet ID is column A and Size is column G


IDSize
189591.000
189591.000
189593.000
189593.000
189606.000
189606.000
189606.000

result should look like this

IDSize
189594.000
189606.000
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
How about
Fluff.xlsm
ABGHIJ
1IDSizeIDSize
2189591189594
3189591189606
4189593
5189593
6189606
7189606
8189606
9
Sheet5
Cell Formulas
RangeFormula
I1:J3I1=LET(u,UNIQUE(FILTER(CHOOSECOLS(B1:G1000,1,-1),B1:B1000<>"")),GROUPBY(INDEX(u,,1),INDEX(u,,2),SUM,3,0))
Dynamic array formulas.
 
Upvote 1
Solution
That doesn't sum the unique values from the 2nd col, its adds them all.
 
Upvote 0
Book1
AB
1IDSize
2189591
3189591
4189593
5189593
6189606
7189606
8189606
9
10result should look like this
11
12IDSize
13189594
14189606
Sheet1
Cell Formulas
RangeFormula
B13:B14B13=IF(A13<>"",SUM(IF(FREQUENCY(IF($A$2:$A$8=A13,MATCH($A$2:$A$8&$B$2:$B$8,A$2:A$8&B$2:B$8,0)),ROW($A$2:$A$8)-ROW($A$2)+1),$B$2:$B$8)),"")


control +shift+enter

copy down
 
Upvote 0
How about
Fluff.xlsm
ABGHIJ
1IDSizeIDSize
2189591189594
3189591189606
4189593
5189593
6189606
7189606
8189606
9
Sheet5
Cell Formulas
RangeFormula
I1:J3I1=LET(u,UNIQUE(FILTER(CHOOSECOLS(B1:G1000,1,-1),B1:B1000<>"")),GROUPBY(INDEX(u,,1),INDEX(u,,2),SUM,3,0))
Dynamic array formulas.

I pride myself on knowing excel but I have no clue what is going on here. Either way it works perfectly. Thank you so much! You have saved me so much aggravation.
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,809
Messages
6,174,761
Members
452,582
Latest member
ruby9c

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top