ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Find second to last value in cell (https://www.excelbanter.com/excel-worksheet-functions/262362-find-second-last-value-cell.html)

Eric_G

Find second to last value in cell
 
Unless most "right" or "left" functions in which one is looking to select the
"LAST" or the "FIRST" value within a string of characters within a call, I
wish to select the "SECOND TO LAST" value within a string of characters
within a call. IN other words, assume the string of characters of a cell
ends with "Fname Lname". I wish to select "Fname" from the character string
and place it in another column. Any ideas? Much appreciated.

Teethless mama

Find second to last value in cell
 
=TRIM(LEFT(RIGHT(SUBSTITUTE(A1," ",REPT(" ",99)),198),99))


"Eric_G" wrote:

Unless most "right" or "left" functions in which one is looking to select the
"LAST" or the "FIRST" value within a string of characters within a call, I
wish to select the "SECOND TO LAST" value within a string of characters
within a call. IN other words, assume the string of characters of a cell
ends with "Fname Lname". I wish to select "Fname" from the character string
and place it in another column. Any ideas? Much appreciated.


Roger Govier[_8_]

Find second to last value in cell
 
Very nice solution, Teethless Mama!
--
Regards
Roger Govier

Teethless mama wrote:
=TRIM(LEFT(RIGHT(SUBSTITUTE(A1," ",REPT(" ",99)),198),99))


"Eric_G" wrote:

Unless most "right" or "left" functions in which one is looking to select the
"LAST" or the "FIRST" value within a string of characters within a call, I
wish to select the "SECOND TO LAST" value within a string of characters
within a call. IN other words, assume the string of characters of a cell
ends with "Fname Lname". I wish to select "Fname" from the character string
and place it in another column. Any ideas? Much appreciated.


Bob Phillips[_4_]

Find second to last value in cell
 
Looks like overkill to me, the RIGHT seems superfluous as it seems fine to
just use

=TRIM(LEFT(SUBSTITUTE(A1," ",REPT(" ",99)),99))

--

HTH

Bob

"Roger Govier" wrote in message
...
Very nice solution, Teethless Mama!
--
Regards
Roger Govier

Teethless mama wrote:
=TRIM(LEFT(RIGHT(SUBSTITUTE(A1," ",REPT(" ",99)),198),99))


"Eric_G" wrote:

Unless most "right" or "left" functions in which one is looking to
select the "LAST" or the "FIRST" value within a string of characters
within a call, I wish to select the "SECOND TO LAST" value within a
string of characters within a call. IN other words, assume the string
of characters of a cell ends with "Fname Lname". I wish to select
"Fname" from the character string and place it in another column. Any
ideas? Much appreciated.




Bob Phillips[_4_]

Find second to last value in cell
 
Oops, my mistake, I missed the OPs request for Second to last :-)

--

HTH

Bob

"Roger Govier" wrote in message
...
Very nice solution, Teethless Mama!
--
Regards
Roger Govier

Teethless mama wrote:
=TRIM(LEFT(RIGHT(SUBSTITUTE(A1," ",REPT(" ",99)),198),99))


"Eric_G" wrote:

Unless most "right" or "left" functions in which one is looking to
select the "LAST" or the "FIRST" value within a string of characters
within a call, I wish to select the "SECOND TO LAST" value within a
string of characters within a call. IN other words, assume the string
of characters of a cell ends with "Fname Lname". I wish to select
"Fname" from the character string and place it in another column. Any
ideas? Much appreciated.





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

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