ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   =TRIM(LEFT(B50,FIND(" ",B50)-1)) (https://www.excelbanter.com/excel-discussion-misc-queries/253454-%3Dtrim-left-b50-find-b50-1-a.html)

Jim

=TRIM(LEFT(B50,FIND(" ",B50)-1))
 
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

T. Valko

=TRIM(LEFT(B50,FIND(" ",B50)-1))
 
Try this...

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

--
Biff
Microsoft Excel MVP


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




Gord Dibben

=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



Gord Dibben

=TRIM(LEFT(B50,FIND(" ",B50)-1))
 
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

On Thu, 14 Jan 2010 17:09:47 -0500, "T. Valko"
wrote:

Try this...

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



T. Valko

=TRIM(LEFT(B50,FIND(" ",B50)-1))
 
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!

--
Biff
Microsoft Excel MVP


"Gord Dibben" <gorddibbATshawDOTca wrote in message
...
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

On Thu, 14 Jan 2010 17:09:47 -0500, "T. Valko"
wrote:

Try this...

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






All times are GMT +1. The time now is 06:39 PM.

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