Interesting formula

zacemmel

Well-known Member
Joined
Apr 29, 2002
Messages
636
I want to return the name "Tom" from cell A1 where cell A1 contains "Harry, Sally, Bob, Jack, Tom."

I am just curious how other board members have approached this problem.
 
No, I want the last name of the cell. I don't want to find tom. I want to find the last name in the series in that cell.

ie cell A1 contains

sally, fred, jack, tom

I want tom in that case

ie cell A1 contains

fred, sally, chris

I want chris in that case

Does that make it any clearer?

Thanks for the help.
 
Upvote 0

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
To further generalize it -- if the entry to be searched for is in cell A3, then use

=MID(A1,FIND(A3,A1,1),LEN(A3))

Regards!
Yogi Anand
 
Upvote 0
On 2002-05-01 14:53, zacemmel wrote:
No, I want the last name of the cell. I don't want to find tom. I want to find the last name in the series in that cell.

ie cell A1 contains

sally, fred, jack, tom

I want tom in that case

ie cell A1 contains

fred, sally, chris

I want chris in that case

Does that make it any clearer?

Thanks for the help.

See my reply...
 
Upvote 0
Sometimes there are spaces, sometimes there aren't. I wrote my own formula though :) Thanks!
 
Upvote 0
In case you are curious, I did an array formula:

{=MID(A1,MAX(IF(MID(A1, ROW(A1:A1000),1)=",", ROW(A1:A1000), -99999))+1,LEN(A1))}
 
Upvote 0
On 2002-05-01 15:05, zacemmel wrote:
Sometimes there are spaces, sometimes there aren't. I wrote my own formula though :) Thanks!

Even then (with these additional specs) the formula I jotted down slightly modified to take "," as delimiter will do.

:biggrin:
 
Upvote 0
Also try

=MID(A1,FIND("~",SUBSTITUTE(A1,",","~",LEN(A1)-LEN(SUBSTITUTE(A1,",",""))),1)+1,LEN(A1))

Regards!
Yogi Anand
 
Upvote 0
Or you could create your own funtion to do this:

Function FindLastValue(List As Variant) As Variant
FindLastValue = trim(Mid(List, InStrRev(List, ",") + 1, Len(List) - InStrRev(List, ",") + 1))
End Function

And then say FindLastValue(a1).
 
Upvote 0

Forum statistics

Threads
1,215,159
Messages
6,123,348
Members
449,097
Latest member
thnirmitha

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top