use wildcard charachter over left()

  • Thread starter Thread starter Matthew Dyer
  • Start date Start date
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?
 
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)
 
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
 
Back
Top