ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   is Error help (https://www.excelbanter.com/excel-discussion-misc-queries/241579-error-help.html)

Jim

is Error help
 
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


Bob Umlas[_3_]

is Error help
 
==IF(A1="","",TRIM(LEFT(A1,FIND("-",A1)-1)))


"Jim" wrote in message
...
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




Don Guillett

is Error help
 

=IF(ISERR(FIND("-",A1)),"",LEFT(A1,FIND("-",TRIM(A1))-1))
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Jim" wrote in message
...
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



David Biddulph[_2_]

is Error help
 
=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)),"")
--
David Biddulph

"Jim" wrote in message
...
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





All times are GMT +1. The time now is 12:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com