ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Find text within cell then display text to left (https://www.excelbanter.com/excel-discussion-misc-queries/83623-find-text-within-cell-then-display-text-left.html)

Jambruins

Find text within cell then display text to left
 
In cell E2 I have the following:
St Louis Cardinals vs Pittsburgh Pirates for Game

In cell E10 I have the following:
Chicago Cubs vs Los Angeles Dodgers for Game

I would like a formula in cell K2 to do the following:
Find the vs in cell E2 and then display all the text to the left of it (St
Louis Cardinals in this case). I included the cell E10 info so you can see
that the text to the left of the vs is not the same number of characters so I
can't just use the left formula. Any ideas? Thanks.


Biff

Find text within cell then display text to left
 
Hi!

Try this:

=LEFT(E2,FIND(" vs ",E2)-1)

Biff

"Jambruins" wrote in message
...
In cell E2 I have the following:
St Louis Cardinals vs Pittsburgh Pirates for Game

In cell E10 I have the following:
Chicago Cubs vs Los Angeles Dodgers for Game

I would like a formula in cell K2 to do the following:
Find the vs in cell E2 and then display all the text to the left of it (St
Louis Cardinals in this case). I included the cell E10 info so you can
see
that the text to the left of the vs is not the same number of characters
so I
can't just use the left formula. Any ideas? Thanks.




Elkar

Find text within cell then display text to left
 
Try this:

=LEFT(E2,FIND("vs",E2,1)-2)

HTH,
Elkar

"Jambruins" wrote:

In cell E2 I have the following:
St Louis Cardinals vs Pittsburgh Pirates for Game

In cell E10 I have the following:
Chicago Cubs vs Los Angeles Dodgers for Game

I would like a formula in cell K2 to do the following:
Find the vs in cell E2 and then display all the text to the left of it (St
Louis Cardinals in this case). I included the cell E10 info so you can see
that the text to the left of the vs is not the same number of characters so I
can't just use the left formula. Any ideas? Thanks.


Ron Coderre

Find text within cell then display text to left
 
Try this:

K2: =LEFT(E2,SEARCH(" vs",E2)-1)

Does that help?

***********
Regards,
Ron

XL2002, WinXP-Pro


"Jambruins" wrote:

In cell E2 I have the following:
St Louis Cardinals vs Pittsburgh Pirates for Game

In cell E10 I have the following:
Chicago Cubs vs Los Angeles Dodgers for Game

I would like a formula in cell K2 to do the following:
Find the vs in cell E2 and then display all the text to the left of it (St
Louis Cardinals in this case). I included the cell E10 info so you can see
that the text to the left of the vs is not the same number of characters so I
can't just use the left formula. Any ideas? Thanks.


Jambruins

Find text within cell then display text to left
 
Thanks for the help. It works perfectly!

Biff

Find text within cell then display text to left
 
You're welcome. Thanks for the feedback!

If you want to extract Pittsburgh Pirates:

=MID(E2,FIND(" vs ",E2)+4,FIND(" for ",E2)-(FIND(" vs ",E2)+3))

Biff

"Jambruins" wrote in message
...
Thanks for the help. It works perfectly!





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

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