Find position of a character within the worksheet cell
If you have a cell whose contents contain a sentence of text with several
spaces, how can you find the position of the last space? Thanks in advance, Christmas May |
Find position of a character within the worksheet cell
InstrRev() function. Perhaps I should read the help files before posting!
"Christmas May" wrote: If you have a cell whose contents contain a sentence of text with several spaces, how can you find the position of the last space? Thanks in advance, Christmas May |
Find position of a character within the worksheet cell
Try
=FIND(CHAR(1),SUBSTITUTE(A1," ",CHAR(1),LEN(A1)-LEN(SUBSTITUTE(A1," ","")))) As you posted in programming here's a VB solution Lastspace = Len(Left(Range("A1"), InStrRev(Range("A1"), " ") - 1)) + 1 Mike Mike "Christmas May" wrote: If you have a cell whose contents contain a sentence of text with several spaces, how can you find the position of the last space? Thanks in advance, Christmas May |
Find position of a character within the worksheet cell
Far too complicated
Lastspace = InStrRev(Range("A1"), " ") Mike "Mike H" wrote: Try =FIND(CHAR(1),SUBSTITUTE(A1," ",CHAR(1),LEN(A1)-LEN(SUBSTITUTE(A1," ","")))) As you posted in programming here's a VB solution Lastspace = Len(Left(Range("A1"), InStrRev(Range("A1"), " ") - 1)) + 1 Mike Mike "Christmas May" wrote: If you have a cell whose contents contain a sentence of text with several spaces, how can you find the position of the last space? Thanks in advance, Christmas May |
All times are GMT +1. The time now is 08:17 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com