Complex Unique Count - Is This Possible?

AndyPandy27

Board Regular
Joined
Jul 17, 2012
Messages
142
Hi All,

I'm ideally looking for a one-cell solution, happy with a formula or VBA function (it needs to be able to update as the background data updates though).

I have a data set in the background similar to the below (assume "Name" is in Cell A1):

NameAccountItemGroupSales
Person AAccount 1Item 1Group 1$1,500
Person AAccount 2Item 1Group 1$500
Person AAccount 1Item 2Group 2$500
Person AAccount 2Item 2Group 2$500
Person AAccount 3Item 1Group 1$2,500
Person AAccount 1Item 3Group 1$1,500
Person AAccount 2Item 3Group 1$2,500
Person BAccount 4Item 1Group 1$500
Person BAccount 5Item 1Group 1$700
Person BAccount 4Item 2Group 2$500
Person BAccount 5Item 2Group 2$500
Person BAccount 4Item 3Group 1$500
Person BAccount 4Item 4Group 2$2,500
Person BAccount 5Item 1Group 1$1,500

<tbody>
</tbody>

(The above would be updated on a monthly basis; it would remain in the same format, but the values and the number of rows would change.)

There is then a separate worksheet, which contains a data validation drop-down, allowing a user to select a "Name".

I need to be able to calculate the unique number of Accounts, linked to that selected Name, which have total sales for Group 1 >$2,000.

Using the above example, if a user had selected Person A, the result would be: 3 (the 2 x orange font lines for Account 1, the 2 x blue font lines above for Account 2 and the 1 x red font line above for Account 3).

Is there a way to perform the aggregation of sales at Name/Account/Group level, then calculate the number of those aggregations which meet a set criterion (in this case >$2,000)...?

Any help greatly appreciated.

AP
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
I failed to update the SumIfs bit with the additional condition...

=SUM(IF(FREQUENCY(IF($A$2:$A$15=G$1,IF(1-($B$2:$B$15=""),IF($D$2:$D$15=G$3,IF(SUMIFS($E$2:$E$15,$D$2:$D$15,G$3,$A$2:$A$15,A2:A15)>G$2,MATCH($B$2:$B$15,$B$2:$B$15,0))))),ROW($B$2:$B$15)-ROW($B$2)+1),1)

Aha! All working now.

Thanks again - this is great.

AP
 
Upvote 0

Forum statistics

Threads
1,216,477
Messages
6,130,879
Members
449,603
Latest member
dizze90

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