use wildcard charachter over left()

M

Matthew Dyer

currently I am using the following code to determine if my reference
cell starts with S

=if(LEFT(B2, 1)<>"S", "true", "false")

I want to use a wildcard instead to avoid having to use the nested
function but the following formula doesnt work

=IF(B2="S*","true", "false")

i understand that the first fomula is looking for S as the left-most
charachter in cell B2. I also understand that the second formula is
looking for S* as the value of B2. How can I achieve my goal of
looking for any value that BEGINS with S without using a nested
function?
 
R

Rick Rothstein

currently I am using the following code to determine if my reference
cell starts with S

=if(LEFT(B2, 1)<>"S", "true", "false")

I want to use a wildcard instead to avoid having to use the nested
function but the following formula doesnt work

=IF(B2="S*","true", "false")

i understand that the first fomula is looking for S as the left-most
charachter in cell B2. I also understand that the second formula is
looking for S* as the value of B2. How can I achieve my goal of
looking for any value that BEGINS with S without using a nested
function?

There is nothing wrong with nesting functions and if your formula works,
then that is fine. However, with that said, here is a way to do what you
want with only one function call...

=IF(COUNTIF(A1,"S*"),"true","false")

Rick Rothstein (MVP - Excel)
 
G

Gord Dibben

Rick

Why is your suggestion of =IF(COUNTIF(A1,"S*"),"true","false") any less
"nested" than OP's =if(LEFT(B2, 1)<>"S", "true", "false")


Gord
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top