=TRIM(LEFT(B50,FIND(" ",B50)-1))

  • Thread starter Thread starter Jim
  • Start date Start date
J

Jim

Hello,

Thanks for the help. How would I write this formula so that it avoids
errors if the referenced cell is blank?

=TRIM(LEFT(B50,FIND(" ",B50)-1))

Thanks
Jim
 
There are two conditions that would give you an error.

1. Blank cell

2. Non-blank cell but no spaces.

If you sure there will only be a blank cell or text string containing a
space then

=IF(B50="","",TRIM(LEFT(B50,FIND(" ",B50)-1)))

Elsewise

=IF(ISERROR(TRIM(LEFT(B50,FIND(" ",B50)-1))),"",TRIM(LEFT(B50,FIND("
",B50)-1)))


Gord Dibben MS Excel MVP
 
Looking good Biff

Why can't I do things like that?

If I had to build a house I would de-forest the country<g>


Gord
 
If I had to build a house I would de-forest the country<g>

Yeah, but I'll bet you'd have a very sturdy house!
 
Back
Top