Wildcards *?~….what am I talking about? And no, it’s not an expletive. Let’s start with an example.

COUNTIF using Wildcards

Excel COUNTIF text in a string using wildcards

What say you wanted to count the number of cells containing the word ‘apple’ in this table.

You could simply use a wildcard (an asterisk, *, is a wildcard in Excel) in your COUNTIF formula like this:


Your result will be 4.

Notice that the wildcard search is not case sensitive and it will count any instance of the word, even where it’s not a word on its own like in the case of ‘Pineapples’.

Alternatively, if you wanted to reference a cell instead of typing in the word ‘apples’ your formula would be:


Where cell A1 contains the word ‘apples’.

All we are doing here is adding an asterisk to the word ‘apples’ in A1 using the ampersand. More on using the ampersand (&) to join text.

SUMIF using Wildcards

Excel SUMIF text in a string using wildcards

The SUMIF formula in cell B23 is:


VLOOKUP Formula using Wildcards

In the table below is a list of Car Manufacturers and their location. We’ve named the range of this table car_manufacturers.

Excel VLOOKUP tex in a string using wildcards

In column B of the table below we want to find the location of the car manufacturer but we only want to type in the short name for the manufacturer into Column A. e.g. ‘Ford’ instead of ‘Ford Motor Company of Australia’.

Excel VLOOKUP tex in a string using wildcards

In cell B29 our VLOOKUP formula is:


Again, we’ve used the ampersand to add wildcards around ‘Ford’ in cell A29 before we look it up in our car_manufacturers table.

The Final Word on Wildcards

The other Wildcards you can use are the question mark ? and tilde ~.

The asterisk we’ve used already allows you to search for a string of text, but if you only want to search for one variable you can use the question mark wild card like this:

? Wildcard

Excel ? wildcard


gives a result of 3.

Notice it will find words ending in ‘s’ like ‘apples’ but won’t find ‘apple’ because the ? is a place holder for another character.

~ Wildcard

Excel tilde wildcard


give a result of 1

The tilde wild card allows you to search for words that contain a wild card – either * or ?.

Simply placing the tilde before the asterisk tells Excel that the asterisk is not to be used as a wildcard.

There are other formulas you can use Wildcards with so feel free to experiment. Please post your discoveries in the comments below for all to share.

Download the workbook and have a play around.

If you liked this sign up for our Excel newsletter below and receive weekly tips & tricks like this straight to your inbox.

Share This

Please share this or leave a comment and I'll make sure you get a personal reply.

Leave a Comment

Current day month ye@r *

{ 26 comments… read them below or add one }

Wanda Ponto January 26, 2014 at 11:00 am

Lets say I wanted to count the number of cells containing the word ‘apple’ in your table… a red apple, gala apple, macintosh apple as those are “apples”. I don’t want a pineapple because it isn’t an apple – its a pineapple. What formula would you use then?


Catalin Bombea January 26, 2014 at 3:42 pm

Hi Wanda,
The first step to build a formula, is to analyze the data. Identifying patterns in data is the most important in this case. In this case, i will use this pattern: “the word apple has a space in front of it, if ‘apple’ is contained in another word, don’t count it”. For these 4 values: “red apple” , “macintosh apple” , ” gala apple”, ” pineapple”, the function: =COUNTIF(A12:A15,”* apple*”) will return 3, because “pineapple” does not correspond to the pattern. The “*” wildcard used in criteria will tell the function that there can be any characters in front of and after the sequence ” apple”.
Hope it’s clear :)


Brad Morse October 9, 2013 at 4:53 pm

Wild cards don’t work in array formulas or with SUMPRODUCT:

=SUMPRODUCT((C3:C10)*(B3:B10″Invoice $”)*(B3:B10″Ck #483″))
{=SUM((C3:C10)*(B3:B10″Invoice $”)*(B3:B10″Ck #483″))}

I wanted to use “Invoice*” and “Ck*” but the “wildcard” asterisk is ignored.


Mynda Treacy October 9, 2013 at 9:21 pm

Hi Brad,

You can use this formula:

=SUMPRODUCT(C3:C10*(ISNUMBER(SEARCH("ck*",B3:B10))+(ISNUMBER(SEARCH("Invoice $*",B3:B10)))))

Array entered i.e. CTRL+SHIFT+ENTER

Kind regards,



Angelique October 1, 2013 at 4:10 am

I can’t find anything that states this outright but it seems that the wildcards will not include empty strings. So if I do a SUMIFS statement and the values for one of the conditions are NULL or a blank string, it will not include those corresponding values in the sum. Is there a work around that you know of?

Example referencing your SUMIF statement above: if you change the formula to =SUMIF(A17:A21,”*”,B17:B21) and delete the “green apples” in A18, the result is $241.00.


Mynda Treacy October 1, 2013 at 7:25 pm

Hi Angelique

You can use this SUMPRODUCT formula:


Kind regards,



mostafa ahmadi September 28, 2013 at 8:45 pm

from iran
thanks of help


Mynda Treacy September 29, 2013 at 9:24 pm

You’re welcome :)


Michael Bugg June 28, 2013 at 6:34 am

Thank you very much for your website; it’s wonderful finding _clear_ answers to my Excel questions.


Mynda Treacy June 28, 2013 at 10:36 am

You’re welcome, Michael :)


Subash February 18, 2013 at 7:21 pm

Just for your information:

This formula works beautifully with sumif also.



Carlo Estopia February 18, 2013 at 8:26 pm

Hi Subash,

Thanks for sharing.


ps: I got your file already from HELP DESK. I’ll send it to you ASAP.


Jane February 15, 2013 at 10:45 pm

Just wanted to say thank you. Your website was very helpful


Carlo Estopia February 16, 2013 at 2:16 pm

Hi Jane,

On behalf of Mynda and Philip, You’re welcome.




bob October 12, 2012 at 4:26 pm

Your vLookup wildcard trick does not work is Column A’s keyword has multiple keywords in it. For example instead of just having “ford” if it has “ford motor” it error’s out.

Any solution for that bug?


Mynda Treacy October 14, 2012 at 9:14 pm

Hi Bob,

It’s not a bug, the formula is doing what it is supposed to do. i.e. Find a specific word within a cell. It actually does work for ‘Ford Motor’ but it would give an error if you looked up ‘Ford Car’, since the string ‘Ford Car’ does not exist in the Lookup Table.

Are you saying you want to look up ‘Ford Car’ and if it finds ‘Ford’ or ‘Car’ it should give you the result? Can you please be more specific about what you want your formula to do.




Scott April 30, 2013 at 12:37 am

I have a request similar to bob’s – I believe. I want a Lookup table that contains wildcards (e.g. *Ford*, *Audi*) and then if the string being looked up contains a match, return the value in the second column. For example, I want “Ford Car” and “Henry Ford” to return Geelong, Victoria.

Is this possible? Any assistance would be fantastic!



Carlo Estopia April 30, 2013 at 10:28 am

Hi Scott,

I have downloaded the workbook and it works just fine.

I even tried to use ‘Motor’ as the look-up value and it still work.
I’m referring to this formula:


and this table

Car Manufacturer	         Location
Ford Motor Company of Australia	 Geelong, Victoria
General Motors-Holden Ltd	 Port Melbourne, Victoria
Audi Australia	                 Botany, NSW
BMW Group Australia	         Mulgrave, VIC
Chrysler	                 Dandenong, VIC




sathi kunti July 25, 2012 at 8:36 pm

please show me how excel formula and function is used in banking back office job. and data entry job with example


Mynda Treacy July 25, 2012 at 8:48 pm

Hi Sathi,

There isn’t one, or even a bunch of formulas that are specific to ‘banking back office jobs’. I know because I worked in the back office of investment banks for 8 years. For this type of job you’d need to know Excel to an advanced level.

You can find an index of tutorials on common formulas here.

I hope this points you in the right direction.

All the best,



Sue-Ting Chene July 19, 2012 at 2:56 pm

For COUNTIF using WILDCARDS, I needed a “&” before AND after the A1

so instead of
=COUNTIF(A5:A9,”*”&A1”*”) Where cell A1 contains the word ‘apples’.

=COUNTIF(A5:A9,”*”&A1&”*”) Where cell A1 contains the word ‘apples’.

This particular use was hard for me to find online. Thanks!


Mynda Treacy July 19, 2012 at 9:40 pm

Hi Sue-Ting,

Yes, correct. You need an ampersand before and after the A1 reference. I will correct the typo in the post above. Sorry for the confusion.

Kind regards,



David M July 10, 2012 at 9:37 pm

Your site was the only site I found that demonstrated how to do a HLOOKUP wildcard search linked to a cell reference (“*”&K3&”*”). Most have the actual value hardcoded in the formula which wasn’t practical for my purpose.
Thank you for solving my problem.


Mynda Treacy July 10, 2012 at 9:44 pm

:) thanks, David. Glad to help out.


Laura March 9, 2012 at 4:26 am

I am trying to use a wildcard in my VLOOKUP formula that will find values in column A that contains a value from K3 (an approximate match). If it finds K3 then I want it to sum up columns 3 through 9. Here’s what I have, which is giving me a result of 0. It should give me $65k.


K3 = Health Care
Column A has “Health Care – Facility B”


Mynda Treacy March 9, 2012 at 12:59 pm

Hi Laura,

Try typing the double quotes in Excel again. Notice how the double quotes in your formula are on a slant? When I copied your formula into Excel it didn’t work either. Then I typed the double quotes in again and voila, all good.

Oh, and this is an array formula so you’re entering it with CTRL+SHIFT+ENTER aren’t you?

I hope that fixes it at your end too. Let me know if not.

Kind regards,



Previous post:

Next post: