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.
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
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:
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,214,942
Messages
6,122,366
Members
449,080
Latest member
Armadillos

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