Sum of unique values for conditional lookup

drsgizmo

New Member
Joined
Jun 28, 2019
Messages
10
1BynI.jpg


For this dataset, I'm trying to write a formula in Table3 that will sum the revenue amount (from Table2) of any ID that is associated with domain in Table1. The formula should first pull the list of unique IDs that are associated with the domain, so for 'a.com' it would create the array {1,2,3}. It would then find the revenue amount for each of those IDs, so {1,2,3} becomes {100,200,400}. It would then sum that array, in this case to arrive at $700. I've tried so far this

{=SUM(IF(COUNTIFS(Table1[Domains],$G$3,Table1[ID],$D$3:$D$6)>0,INDEX(Table2[Revenue], MATCH($D$3:$D$6, Table2[ID],0)),0))}

and

{=SUM(IF($B$3:$B$18=G3,VLOOKUP($A$3:$A$18,$D$3:$E$6,2,0),0))}

neither of which work. Any help is very appreciated.
 
Try

=SUM(SUMIF(Table2[ID],IF(FREQUENCY(IF(ISNUMBER(SEARCH([@Domains],Table1[Domain])),Table1[ID]),Table1[ID]),Table1[ID]),Table2[Revenue]))
Ctrl+Shift+Enter

M.
 
Upvote 0

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Forum statistics

Threads
1,215,411
Messages
6,124,759
Members
449,187
Latest member
hermansoa

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