is Error help

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

Jim

Hello,

I'm currently using the following formula:

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

How would I write this so that if the referred to cell is blank then the
cell I have the formula in shows blank instead of an error?

Thanks
Jim
 
=IF(A1="","",TRIM(LEFT(A1,FIND("-",A1)-1)))
If you want to trap for cell contents not including a hyphen, you may prefer
=IF(ISNUMBER(FIND("-",A1)),TRIM(LEFT(A1,FIND("-",A1)-1)),"")
 
Back
Top