Exact matches when using COUNTIFS

katel99

New Member
Joined
Nov 8, 2017
Messages
16
Hi there,

I am trying to use the COUNTIFS funtion to highlight duplicate rows.

Here is an example of my data:

_____A _________B _____C_______D
1 UserID _____Name __Licence__Duplicate?

2 ABC1 ..............Joe ........1CL** ......=COUNTIFS(A:A,$A2,C:C,$C2)

3 ABC1...............Joe.........1CL*2........

4 ABC1...............Joe.........1CL**

5 BCD1...............Amy........1CL



As per the above, I would expect the result to tell me that there are 2 matches for rows 2 and 4, however because of the * in the "Licence" column (column C) my countifs formula is saying there are 3 matches (as it is assuming the * is a wild card, and is including row 3 in it's count)

Unfortunately I have no control of the *s in the data set, so I am wondering if it is possible to add something to the countifs formula to stop it using the * as a wild card? The above data set is very basic, there are multiple licence types I am comparing and I want this to be a repeatable process, so using "1CL**" is not an option.

Thanks in advance,

Kate :)
 
Last edited:

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
One way might be to insert a helper column. In column D have: =SUBSTITUTE(C2,"*","#") and in column E have: =COUNTIFS(A:A,$A2,D:D,$D2)

This assumes your licence values don not have any # character in them. If they do, replace the # in the formula with an unused character.
 
Upvote 0
That's a great shout, thank you! Had been going a bit cross eyed and couldn't see the wood from the trees.

:)
 
Upvote 0
For your second criteria, you can use the SUBSTITUTE function to replace each occurrence of an asterisk (*) with a tilde and asterisk (~*)...

=COUNTIFS(A:A,$A2,C:C,SUBSTITUTE(C2,"*","~*"))

Hope this helps!
 
Upvote 0
For your second criteria, you can use the SUBSTITUTE function to replace each occurrence of an asterisk (*) with a tilde and asterisk (~*)...

Nice one, Domenic - more elegant than mine.
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,912
Members
452,366
Latest member
TePunaBloke

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