Excel formula to count unique cells in column Q with multiple criteria

Knockoutpie

Board Regular
Joined
Sep 10, 2018
Messages
116
Office Version
  1. 365
Platform
  1. Windows
I put together this sumproduct formula which works to calculate total sales using a few critiera
  • Column G Sheet 2 : brand Name
  • Cell A2 Sheet 1 = Brand name
  • Column AE Sheet 2 = Transaction date column - which is converted to Year (B13) and Month (C1)
  • Column AY Sheet 2 = Transaction value total
=SUMPRODUCT(--('Sheet2'!$G2:$G10000='Sheet1'!$A$2),--(YEAR('Sheet2'!$AE2:$AE10000)='Sheet1'!$B13),--(MONTH('Sheet2'!$AE2:$AE10000)='Sheet1'!C$1),'Sheet2'!$AY2:$AY10000)

The end result which works: Calculates total sales based on 3 criteria, month, year and brand.
How can I modify this formula to instead calculate the total unique cells (customers) in column Q in Sheet 2?
I assumed it would be as easy as modifying my sum array which is bold in the formula above but I have not figured it out.

If it helps, i do have two formulas which gives me the total unique cell count in the column, I just can't figure out how to add either into my formula..

=COUNTA(UNIQUE('Sheet2'!Q2:Q10000))

=SUMPRODUCT(1/COUNTIF('Sheet2'!Q2:Q27932,'Sheet2'!Q2:Q10000))
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
How about
Excel Formula:
=ROWS(UNIQUE(FILTER(Sheet2!$Q2:$Q10000,(Sheet2!$G2:$G10000=$A$2)*(YEAR(Sheet2!$AE2:$AE10000)=$B13)*(MONTH(Sheet2!$AE2:$AE10000)=C$1))))
 
Upvote 1
Solution
How about
Excel Formula:
=ROWS(UNIQUE(FILTER(Sheet2!$Q2:$Q10000,(Sheet2!$G2:$G10000=$A$2)*(YEAR(Sheet2!$AE2:$AE10000)=$B13)*(MONTH(Sheet2!$AE2:$AE10000)=C$1))))
Nailed it! Thanks Fluff!
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0
You're welcome & thanks for the feedback.
Hey Fluff, side note.. could you please find a way to modify this instead of referring to C1 which is Month 1, Refer to C1+D2+E3, this will give me total unique customer count for 3 months.
 
Upvote 0
Try
Excel Formula:
=ROWS(UNIQUE(FILTER(Sheet2!$Q2:$Q10000,(Sheet2!$G2:$G10000=$A$2)*(YEAR(Sheet2!$AE2:$AE10000)=$B13)*((MONTH(Sheet2!$AE2:$AE10000)=C$1)+(MONTH(Sheet2!$AE2:$AE10000)=D2)+(MONTH(Sheet2!$AE2:$AE10000)=E3)))))
 
Upvote 0
Try
Excel Formula:
=ROWS(UNIQUE(FILTER(Sheet2!$Q2:$Q10000,(Sheet2!$G2:$G10000=$A$2)*(YEAR(Sheet2!$AE2:$AE10000)=$B13)*((MONTH(Sheet2!$AE2:$AE10000)=C$1)+(MONTH(Sheet2!$AE2:$AE10000)=D2)+(MONTH(Sheet2!$AE2:$AE10000)=E3)))))
very cool, i see what you did there. Thanks again!
 
Upvote 0

Forum statistics

Threads
1,224,884
Messages
6,181,564
Members
453,053
Latest member
Kiranm13

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