Searching from the right of text in a cell

L

Larry

What I need to be able to do is determine how many
characters in from the right of some text in a cell the
first space occurs. The formula SEARCH(" ",A4) will give
me the count to the first space from the left. Does any
now how to get the SEARCH function to perform from the
right of the text?
 
I

immanuel

The following array formula should work.

=MAX(IF(MID(A4,ROW(INDIRECT("1:"&LEN(A4))),1)="
",ROW(INDIRECT("1:"&LEN(A4))),0))

*Ensure that you Ctrl-Shift-Enter this formula instead of just hitting
Enter.

/i.
 
L

Larry

Immanuel - It works great - thankyou
-----Original Message-----
The following array formula should work.

=MAX(IF(MID(A4,ROW(INDIRECT("1:"&LEN(A4))),1)="
",ROW(INDIRECT("1:"&LEN(A4))),0))

*Ensure that you Ctrl-Shift-Enter this formula instead of just hitting
Enter.

/i.





.
 
H

Harlan Grove

The following array formula should work.

=MAX(IF(MID(A4,ROW(INDIRECT("1:"&LEN(A4))),1)=" ",
ROW(INDIRECT("1:"&LEN(A4))),0))

It does, but there's a way to do this without an array formula.

=FIND(CHAR(127),SUBSTITUTE(A1," ",CHAR(127),
LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))
 
I

Immanuel

Very elegant! I like.

/i.

Harlan Grove said:
...

It does, but there's a way to do this without an array formula.

=FIND(CHAR(127),SUBSTITUTE(A1," ",CHAR(127),
LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))

--
Never attach files.
Snip unnecessary quoted text.
Never multipost (though crossposting is usually OK).
Don't change subject lines because it corrupts Google newsgroup archives.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top