0

I have found the the regexmatch solution for substring: Google Sheets formula for "if contains"

However, why for "*" is not working? I'm trying to make a condition if the name contains "*" it will exclude the stamp duty cost.

As for now, I'm using =IF(REGEXMATCH(C11,"-"),0,ROUNDUP(G11/1000,0)).
What is the explanation why "*" cannot be used?

  • 1
    Please edit your question to show the formula which didn't work. – 24601 Nov 26 '20 at 14:19
0

You are trying to create a match condition if a name contains "*" (asterisk). However in the question that you cited, Google Sheets formula for “if contains”, none of the REGEXMATCH answers use an asterisk.

In spreadsheets, the asterisk (*) is normally a wildcard character taking the place of any number of characters. But in regex, the asterisk has a special role as occurrence/Repetition Operator. To match an asterisk (or any other special character) in regex, you need to use a escape sequence prefix with a backslash like this: \*

Try this formula =REGEXMATCH(A2,"\*").

It will return True if Cell A2 contains an asterisk, and False if it does not contain an asterisk.


Example

Example

0

To determine if cell A1 contains an asterisk, use:

=if(iserror(find(char(42),A1)),"No Asterisk","Asterisk")

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.