View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default =TRIM(LEFT(B50,FIND(" ",B50)-1))

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

On Thu, 14 Jan 2010 13:56:02 -0800, Jim
wrote:

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