View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default 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