COUNTIFS Assistance with Duplicate Values & Multiple Criteria

brandon12

New Member
Joined
Sep 12, 2018
Messages
32
https://drive.google.com/open?id=1eqtXSg4kU9vIpss9uc6VUs6mVnzVHHDmStruggling to figure out accurate formulas to return the results I'm looking for. I have attached a spreadsheet for review.

I want this data to provide three values in G4, H4, & I4:

1) The total # of DA's in column C... I'm using: =COUNTIF(C:C,"DA")

2) The total # of occurrences of exactly 1 Service Type "DA" and 1 Service Type "THER NOTE" for the same Client (summing all occurences into one cell).

3) The total # of occurrences of exactly 1 Service Type "DA" and 2 or more Service Type "THER NOTE's" for the same Client (summing all occurrences into one cell).

The result should be:

1) 5

2) 2

3) 2
 
That did the trick. Thank you so much for all your assistance!


The MATCH generates errors if you have empty rows. You can try this:

Code:
=SUM(IFERROR(MATCH($C$2:$C$4000,$C$2:$C$4000,0)=ROW($C$2:$C$4000)-ROW($C$2)+1,0)*(COUNTIFS($C$2:$C$4000,$C$2:$C$4000,$D$2:$D$4000,"DA")=1)*(COUNTIFS($C$2:$C$4000,$C$2:$C$4000,$D$2:$D$4000,"THER NOTE")[COLOR=#ff0000]=[/COLOR]1))

confirmed with Control+Shift+Enter. Change the last = to > for the other formula.
 
Upvote 0

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
I'm attempting to make a modification to a current worksheet. I have three formulas in this worksheet:

1) DA Only: =SUM(IFERROR(MATCH($C$2:$C$3999,$C$2:$C$3999,0)=ROW($C$2:$C$3999)-ROW($C$2)+1,0)*(COUNTIFS($C$2:$C$3999,$C$2:$C$3999,$D$2:$D$3999,"DA")=1)*(COUNTIFS($C$2:$C$3999,$C$2:$C$3999,$D$2:$D$3999,"THER NOTE")=0))

2) DA & 1 THER NOTE: =SUM(IFERROR(MATCH($C$2:$C$3999,$C$2:$C$3999,0)=ROW($C$2:$C$3999)-ROW($C$2)+1,0)*(COUNTIFS($C$2:$C$3999,$C$2:$C$3999,$D$2:$D$3999,"DA")=1)*(COUNTIFS($C$2:$C$3999,$C$2:$C$3999,$D$2:$D$3999,"THER NOTE")=1))

3) DA & 2+ THER NOTES: =SUM(IFERROR(MATCH($C$2:$C$3999,$C$2:$C$3999,0)=ROW($C$2:$C$3999)-ROW($C$2)+1,0)*(COUNTIFS($C$2:$C$3999,$C$2:$C$3999,$D$2:$D$3999,"DA")=1)*(COUNTIFS($C$2:$C$3999,$C$2:$C$3999,$D$2:$D$3999,"THER NOTE")>1))

I would like to return the ClientName (column C) for all DA Only. I have provided the following link for review and highlight the portion I'm attempting to accomplish in blue.

open
https://drive.google.com/open?id=1qWCW5xqeVGxqoJQuL18MzlH0N0BPjA7c
 
Upvote 0
Put this array formula in I9 and drag down:

Code:
=IFERROR(INDEX(C:C,SMALL(IF(COUNTIF(I$8:I8,$C$2:$C$3999)=0,IF(COUNTIFS($C$2:$C$3999,$C$2:$C$3999,$D$2:$D$3999,"DA")=1,IF(COUNTIFS($C$2:$C$3999,$C$2:$C$3999,$D$2:$D$3999,"THER NOTE")=0,ROW($C$2:$C$3999)))),1)),"")

Confirm with Control+Shift+Enter.
 
Upvote 0
Eric, once again you have saved the day. Works wonderfully. Thanks again for your assistance!


Put this array formula in I9 and drag down:

Code:
=IFERROR(INDEX(C:C,SMALL(IF(COUNTIF(I$8:I8,$C$2:$C$3999)=0,IF(COUNTIFS($C$2:$C$3999,$C$2:$C$3999,$D$2:$D$3999,"DA")=1,IF(COUNTIFS($C$2:$C$3999,$C$2:$C$3999,$D$2:$D$3999,"THER NOTE")=0,ROW($C$2:$C$3999)))),1)),"")

Confirm with Control+Shift+Enter.
 
Upvote 0

Forum statistics

Threads
1,214,647
Messages
6,120,722
Members
448,987
Latest member
marion_davis

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