Thoughts From My Life
Oct
14

Escaping The Asterisk (*) in Excel

Written by Neil Galloway
 

I had a formula the other day that needed to see if an asterisk - * was present in a cell. So the formula included a comparison for "*" in the syntax. Anyhow, turns out some formulas (not all) will treat the * as a wildcard and match it to any number of letters or numbers. If you are a programmer, like myself, then you are used to escaping letters with a backslash (\). However, Excel does not use this and the proper escape is a tilde (~).

I was a bit surprised how difficult searching the internet for this solution was, so I'm posting it here too. Hopefully I have good enough keywords and explanation that it will be easier for others like me to find.

So my formula that was giving me issues was a SUMIF. It looked like this:

=SUMIF(A1:A500,"=*",B1:B500)

My intention was to add up all the B column values that had a * in the A column, however it was adding up all the B column fields regardless. Once I changed it to the formula below, it worked just fine.

=SUMIF(A1:A500,"=~*",B1:B500)

If you enjoyed this post, then make sure you subscribe to my RSS feed or subscribe for email updates. Only one email a day and only if there was a new post.



Related Posts

American Express Air Miles Card
2004 Mazda 3 Fuel Economy
Credit Card Fees - Are They Worth It
How To Analyze an Investment Property
CIBC Aerogold and AeroClassic Visas

Email this article

Category: Computers

Original Post: Thursday, October 14th, 2010


0 Comments

No approved comments yet.

Add a Comment

Note: Comments will be visible after they have been moderated.
Name:

Email: (Never made public)

Web Page:
(include http:// or https://)
Comment:


Enter Verification (image below):