Imagine you work at MI5 as a HR officer. You want to find all agents who have license to kill (licence 7). Your data looks like this:

How would you go about it?
If you filter the list or use FIND() or SEARCH() formulas, you will end up with agents who also have licenses 77, 17 or not7. So how would you solve this problem?
Of course, you do what any smart person does. You summon Excel and ask it nicely by using some wicked pattern matching logic.
Finding all cells with 7 in them
Assuming the licenses are in column [licenses], you can use below formula to check if it has 7:
Step 1: Make an extra column, say [Two more commas] and use this formula.
=", "&[@licenses]&", "
Step 2: Now use below formula to find if a license has 7 in it:
=COUNTIFS([@[Two more commas]] , "* 7,*") > 0
This formula returns TRUE if [@licenses] has 7.
So how does it work?
There are three cases for licenses with 7 in them, as shown below.

Once we prefix & suffix COMMASPACE to this, we end up with a text that has the pattern:
<COMMA SPACE number><COMMA SPACE number>...
Now, we simply look for the pattern SPACE7, in this by using the * wildcard along with COUNTIFS.
=COUNTIFS([@[Two more commas]], "* 7,*")
We add a check to see if the count is greater than ZERO (ie did we find the pattern?)
So there you go. Now you can find the agent who can nab the targets.
Related: Using wildcards * ? in Excel VLOOKUP & other functions | Introduction to SUMIFS formula
Adding a few plot twists
Now, your MI5 career would be awfully boring, if there are no plot twists. So Q calls you in to her office and says, “We need a list of all agents who have any of the licenses 7, 65 or 63. Oh, while you are at it, tell me which agents have all three licenses.”
Damn you Q
the evil is you
for making me do
work I don’t want to
Damn you Q.
Added later: Okay, My James Bond knowledge is not very good. M is the boss of MI5, not Q. So let’s assume M calls you in to her office and gives you this task. As usual, you go:
Why do this M?
Everything is ho hum
and then you come
to tell my work is not yumm
Why do this M?
So you are back to your desk. Now the licenses to find are in a named range called list.
You can use COUNTIFS() pattern find logic to get the answer.
For sake of simplicity, let’s assume that you have a new column in your data table called as [Two more commas]
Does the agent have any of the licenses in list?
=SUMPRODUCT(COUNTIFS([@[Two more commas]],"* "&list&",*"))>0
The internal COUNTIFS returns an array of values, which the SUMPRODUCT simply adds up.
Does the agent have all of the licenses in list?
=SUMPRODUCT(COUNTIFS([@[Two more commas]],"* "&list&",*")) = COUNTA(list)
Now, let’s hope Q doesn’t add more plot twists. And if she does, you can always post them in the comments so internet can solve them.
Related: Introduction to Excel SUMPRODUCT function
How would you find license to kill?
I am sure COUNTIFS is not the only way to do this. So what would you do in this case? Will you use formulas / VBA or Power Query? Or something else altogether? Go ahead and share your approach in the comments section.
Note: Thanks to Brian who emailed me this problem.














11 Responses to “Fix Incorrect Percentages with this Paste-Special Trick”
I've just taught yesterday to a colleague of mine how to convert amounts in local currency into another by pasting special the ROE.
great thing to know !!!
Chandoo - this is such a great trick and helps save time. If you don't use this shortcut, you have to take can create a formula where =(ref cell /100), copy that all the way down, covert it to a percentage and then copy/paste values to the original column. This does it all much faster. Nice job!
I was just asking peers yesterday if anyone know if an easy way to do this, I've been editing each cell and adding a % manually vs setting the cell to Percentage for months and just finally reached my wits end. What perfect timing! Thanks, great tip!
If it's just appearance you care about, another alternative is to use this custom number format:
0"%"
By adding the percent sign in quotes, it gets treated as text and won't do what you warned about here: "You can not just format the cells to % format either, excel shows 23 as 2300% then."
Dear Jon S. You are the reason I love the internet. 3 year old comments making my life easier.
Thank you.
Here is a quicker protocol.
Enter 10000% into the extra cell, copy this cell, select the range you need to convert to percentages, and use paste special > divide. Since the Paste > All option is selected, it not only divides by 10000% (i.e. 100), it also applies the % format to the cells being pasted on.
@Martin: That is another very good use of Divide / Multiply operations.
@Tony, @Jody: Thank you 🙂
@Jon S: Good one...
@Jon... now why didnt I think of that.. Excellent
Thank You so much. it is really helped me.
Big help...Thanks
Thanks. That really saved me a lot of time!
Is Show Formulas is turned on in the Formula Ribbon, it will stay in decimal form until that is turned off. Drove me batty for an hour until I just figured it out.