# Sumproduct count unique items

#### dfenton21

##### Board Regular
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

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
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:
Hi,

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.

Replies
7
Views
298
Replies
2
Views
618
Replies
5
Views
214
Replies
15
Views
483
Replies
0
Views
200

1,203,506
Messages
6,055,800
Members
444,825
Latest member
aggerdanny

### 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?

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