Count Ifs for counting duplicate rows only once combined with multiple criteria

rhmkrmi

Active Member
Joined
Aug 17, 2012
Messages
341
Office Version
  1. 365
Platform
  1. Windows
Hello,

I am trying to use countifs to count column A values for each month in column B without duplicating.

I use this formula and expect to get 3 but it gives me 6.67:
=SUMPRODUCT(1/COUNTIFS(B2:B11,"JUN-21",A2:A11,A2:A11))

NameMonth
JohnJUN-21
JohnJUN-21
JohnJUN-21
JohnJUL-21
JohnJUL-21
MaryAUG-21
MaryJUN-21
SallyJUN-21
SallyAUG-21
SallyAUG-21

Thanks.
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Try this:

=SUMPRODUCT((B2:B11="JUN-21")/COUNTIFS(B2:B11,B2:B11,A2:A11,A2:A11))
 
Upvote 0
Try this:

=SUMPRODUCT((B2:B11="JUN-21")/COUNTIFS(B2:B11,B2:B11,A2:A11,A2:A11))
Is this supposed not work when the data ranges increases?
I am using it to check 30000 rows and Excel keep crashing trying to calculate.

Thanks.
 
Upvote 0
@rhmkrmi
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
Perfect, works like a charm.
Is this supposed not work when the data ranges increases?
I am using it to check 30000 rows and Excel keep crashing trying to calculate.

Thanks.
Try this:

=SUMPRODUCT((B2:B11="JUN-21")/COUNTIFS(B2:B11,B2:B11,A2:A11,A2:A11))
Just a question on #2 above from Phuoc.
Is this supposed not to work when the data range increases?
I am using it to check 30000 rows and Excel keep crashing trying to calculate.

Thank you.
 
Upvote 0
Thanks for updating your profile. (y)

See how this goes

Excel Formula:
=IFNA(ROWS(UNIQUE(FILTER(A2:A30000,B2:B30000="JUN-21",NA()))),0)
 
Upvote 0

Forum statistics

Threads
1,214,551
Messages
6,120,156
Members
448,948
Latest member
spamiki

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