Sumproduct count unique items

dfenton21

Board Regular
Joined
Jun 23, 2007
Messages
135
Hi,
I'm using the following SUMPRODUCT formula to emulate a countif with multiple criteria functionality.

The paramaters are:
Column B contains dates
Column N contains an Item ID number
Cell H13 is a date
Cell H14 is a date

=SUMPRODUCT((B1:B9885>H13)*(N1:N9885=B14))-SUMPRODUCT(B1:B9885>H14)*(N1:N9885=B14))

So, the formula returns the number of times the Item ID occurs between the two specified dates.

If I have a third column containing customer names, is it possible to modify to above formula to return the number of times the Item ID occurs between the two specified date, but only for unique customers

For example,
CUSTOMER ¦ ITEM ID
Name1 ¦ 999
Name1 ¦ 999
Name2 ¦ 999
Name3 ¦ 999
Name2 ¦ 999
Name3 ¦ 999

The formula should return 1, when looking for Name1 and 999 assuming the above information is within the specified date range.

I could probably do this in VBA, but would rather use a formula.

Thanks.
 

Some videos you may like

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Jerry Sullivan

MrExcel MVP
Joined
Mar 18, 2010
Messages
8,787
Hi Damien,

You might try:

Code:
=SUMPRODUCT((B1:B9885>=H13)*(B1:B9885<=H14)*(M1:M9885="Name1")*(N1:N9885="999"))<?XML:NAMESPACE PREFIX = H14)*(M1 /><H14)*(M1:M9885="Name1")*(N1:N9885="999"))<?XML:NAMESPACE PREFIX="H14)*(M1"></H14)*(M1:M9885="Name1")*(N1:N9885="999"))<?XML:NAMESPACE><H14)*(M1:M9885="Name1")*(N1:N9885="999"))< p>

Where:
Your desired dates fall within the dates in H13 and H14 inclusively.
Column M has your Customer Names
Column N has your Item IDs'

Your formula seemed to be referencing B14 as the Cell that has your ID criteria, which confused me since Column B is used for your dates. Not sure if that was a typo or my misunderstanding.

Nonetheless, hopefully you can adapt the formula above to your sheet.

Hope this helps!
</H14)*(M1:M9885="Name1")*(N1:N9885="999"))<>
 
Last edited:

dfenton21

Board Regular
Joined
Jun 23, 2007
Messages
135
Hi,

Thanks for your reply.

The solution seems so obvious once I see it!

And yes, the ID reference was a typo (it's actually column B in another sheet).

Thanks again for your help.
 

Watch MrExcel Video

Forum statistics

Threads
1,108,910
Messages
5,525,583
Members
409,651
Latest member
Quasar Hunter

This Week's Hot Topics

Top