ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Return the text before a | in a text string (https://www.excelbanter.com/excel-worksheet-functions/240681-return-text-before-%7C-text-string.html)

ArcticWolf

Return the text before a | in a text string
 
Hi,

I have a text string and would like all the characters before the | symbol
to be returned. The text before the | is varying lengths.

EG
Pears|Apples.........would return Pears
Bananas|Oranges...........would return Bananas

TIA,

AW

Gary''s Student

Return the text before a | in a text string
 
=LEFT(A1,FIND("|",A1)-1)

--
Gary''s Student - gsnu200901

francis

Return the text before a | in a text string
 
Hi try this

Assuming that your data are in A2 onward with the first row
being the header.
In B2, place this formula and copy down
=LEFT(A2,SEARCH("|",A2)-1)
--
Hope this is helpful

Pls click the Yes button below if this post provide answer you have asked

Thank You

cheers, francis

Am not a greek but an ordinary user trying to assist another



"ArcticWolf" wrote:

Hi,

I have a text string and would like all the characters before the | symbol
to be returned. The text before the | is varying lengths.

EG
Pears|Apples.........would return Pears
Bananas|Oranges...........would return Bananas

TIA,

AW


Jacob Skaria

Return the text before a | in a text string
 
Just to add on.. Why dont you try Text to columns option. If you havent tried
select the range/column needs to be changed.
--From menu DataText to Columns will populate the 'Convert Text to Columns
Wizard'. By default the selection is 'Delimited'. Keep the selection and hit
'Next'.
--From the Step2 of the Wizard from the options in Other Specify the pipe
symbol and hit Next.
--Hit Finish

If this post helps click Yes
---------------
Jacob Skaria


"ArcticWolf" wrote:

Hi,

I have a text string and would like all the characters before the | symbol
to be returned. The text before the | is varying lengths.

EG
Pears|Apples.........would return Pears
Bananas|Oranges...........would return Bananas

TIA,

AW


Rick Rothstein

Return the text before a | in a text string
 
Is it possible for there to be blank cells in the column with your pipe(|)
delimited text? If so, use this...

=LEFT(A1,FIND("|",A1&"|")-1)

One side effect to this... if you have a piece of text without the pipe
symbol in it, the entire text from the cell will be returned.

--
Rick (MVP - Excel)


"ArcticWolf" wrote in message
...
Hi,

I have a text string and would like all the characters before the | symbol
to be returned. The text before the | is varying lengths.

EG
Pears|Apples.........would return Pears
Bananas|Oranges...........would return Bananas

TIA,

AW



ArcticWolf

Return the text before a | in a text string
 
Good tip Jacob. The original is on another worksheet so I've done a little
formula to bring it in.

Thanks for the heads up.

AW

"Jacob Skaria" wrote:

Just to add on.. Why dont you try Text to columns option. If you havent tried
select the range/column needs to be changed.
--From menu DataText to Columns will populate the 'Convert Text to Columns
Wizard'. By default the selection is 'Delimited'. Keep the selection and hit
'Next'.
--From the Step2 of the Wizard from the options in Other Specify the pipe
symbol and hit Next.
--Hit Finish

If this post helps click Yes
---------------
Jacob Skaria


"ArcticWolf" wrote:

Hi,

I have a text string and would like all the characters before the | symbol
to be returned. The text before the | is varying lengths.

EG
Pears|Apples.........would return Pears
Bananas|Oranges...........would return Bananas

TIA,

AW



All times are GMT +1. The time now is 04:47 AM.

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