Thread: If formula
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default If formula

=IF(ISERR(FIND("-",B2)),B2,LEFT(B2,FIND("-",B2)-1))

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Cassius" wrote in message
...
I have cells where I am trying to eliminate text after the dash, but it
gives
me errors if the cells does not contain a dash. How can I have it just
give
me what is in the cell if no dash is found?

For example (the first one gives it to me correctly, but the second one
finds an error)
NL RISON KANTOOR ITEMS-SCHAGEN NL RISON KANTOOR ITEMS
NL PEJO ELECTROSERVICE B V #VALUE!

My formula reads
=TRIM(LEFT(B2,FIND("-",B2)-1))