ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Last piece of text in a string (multiple lengths) (https://www.excelbanter.com/excel-discussion-misc-queries/211823-last-piece-text-string-multiple-lengths.html)

Bob Freeman

Last piece of text in a string (multiple lengths)
 
I am trying to construct a formula which will return the last complete text
string from a cell of text
e.g. 'I like football' will return 'football'
The string to be returned can be of any length.

Many thanks


T. Valko

Last piece of text in a string (multiple lengths)
 
In other words, you want to extract the last word in the string?

Try this:

=TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",255)),255))

--
Biff
Microsoft Excel MVP


"Bob Freeman" wrote in message
...
I am trying to construct a formula which will return the last complete text
string from a cell of text
e.g. 'I like football' will return 'football'
The string to be returned can be of any length.

Many thanks




Bob Freeman

Last piece of text in a string (multiple lengths)
 
Perfect - thank you

"T. Valko" wrote:

In other words, you want to extract the last word in the string?

Try this:

=TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",255)),255))

--
Biff
Microsoft Excel MVP


"Bob Freeman" wrote in message
...
I am trying to construct a formula which will return the last complete text
string from a cell of text
e.g. 'I like football' will return 'football'
The string to be returned can be of any length.

Many thanks





T. Valko

Last piece of text in a string (multiple lengths)
 
You're welcome. Thanks for the feedback!

--
Biff
Microsoft Excel MVP


"Bob Freeman" wrote in message
...
Perfect - thank you

"T. Valko" wrote:

In other words, you want to extract the last word in the string?

Try this:

=TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",255)),255))

--
Biff
Microsoft Excel MVP


"Bob Freeman" wrote in message
...
I am trying to construct a formula which will return the last complete
text
string from a cell of text
e.g. 'I like football' will return 'football'
The string to be returned can be of any length.

Many thanks








All times are GMT +1. The time now is 08:33 PM.

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