ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How to return # characters based on 2nd instance of value (https://www.excelbanter.com/excel-worksheet-functions/26898-how-return-characters-based-2nd-instance-value.html)

JDay01

How to return # characters based on 2nd instance of value
 
I have a range of text fields with descriptions containing a combination of
words and spaces. I want to return the leftmost two words of each
description, however, the position of where the 2nd space occurs varies by
cell.
I have found a way to return the first word by using the following formula:
=LEFT(E4,FIND(" ",E4)-1)) However, I cannot figure out how to return the
TWO words. Can someone help?

Duke Carey

The third argument to Find() is optional, & it indicates which character
Excel should start searching from. You could use 1+ the position of the
first space as the starting point

=LEFT(E4,FIND(" ",E4,1+FIND(" ",E4,1))-1))


"JDay01" wrote:

I have a range of text fields with descriptions containing a combination of
words and spaces. I want to return the leftmost two words of each
description, however, the position of where the 2nd space occurs varies by
cell.
I have found a way to return the first word by using the following formula:
=LEFT(E4,FIND(" ",E4)-1)) However, I cannot figure out how to return the
TWO words. Can someone help?


N Harkawat

=LEFT(A1,FIND("?",SUBSTITUTE(A1," ","?",2)))

"JDay01" wrote in message
...
I have a range of text fields with descriptions containing a combination of
words and spaces. I want to return the leftmost two words of each
description, however, the position of where the 2nd space occurs varies by
cell.
I have found a way to return the first word by using the following
formula:
=LEFT(E4,FIND(" ",E4)-1)) However, I cannot figure out how to return the
TWO words. Can someone help?




JE McGimpsey

One way:

=LEFT(E4,FIND("$",SUBSTITUTE(E4," ","$",2))-1)

In article ,
JDay01 wrote:

I have a range of text fields with descriptions containing a combination of
words and spaces. I want to return the leftmost two words of each
description, however, the position of where the 2nd space occurs varies by
cell.
I have found a way to return the first word by using the following formula:
=LEFT(E4,FIND(" ",E4)-1)) However, I cannot figure out how to return the
TWO words. Can someone help?


Duke Carey

JE & N - I like that. It's very concise.


"JE McGimpsey" wrote:

One way:

=LEFT(E4,FIND("$",SUBSTITUTE(E4," ","$",2))-1)

In article ,
JDay01 wrote:

I have a range of text fields with descriptions containing a combination of
words and spaces. I want to return the leftmost two words of each
description, however, the position of where the 2nd space occurs varies by
cell.
I have found a way to return the first word by using the following formula:
=LEFT(E4,FIND(" ",E4)-1)) However, I cannot figure out how to return the
TWO words. Can someone help?




All times are GMT +1. The time now is 07:38 AM.

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