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

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
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,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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