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.
 
YOU TRY THAT TOO, IT WORKS !!

=IF(LEN(A1)-LEN(SUBSTITUTE(A1," ",""))=0,A1,RIGHT(A1,LEN(A1)-FIND("*",SUBSTITUTE(A1," ","*",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))))

RGDS

ANDREAS
 
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.
On 2002-05-01 15:10, zacemmel wrote:
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))}

Change it so that it has a more usual ROW arg:

{=MID(A1,MAX(IF(MID(A1, ROW(1:1000),1)=",", ROW(1:1000), -99999))+1,LEN(A1))}

It requires TRIM around it too, considering "sometimes spaces, sometimes not".

Aladin
 
Upvote 0
Yes, but when yours didn't have spaces, it returned #VALUE! I actually got a result with mine that wasn't an error :)
This message was edited by zacemmel on 2002-05-01 16:13
 
Upvote 0
On 2002-05-01 16:12, zacemmel wrote:
Yes, but when yours didn't have spaces, it returned #VALUE! I actually got a result with mine that wasn't an error :)
This message was edited by zacemmel on 2002-05-01 16:13

You missed the point of my comment. And, I wasn't comparing it with anything.

Moreover, I told you the formula I suggested can accomodate "," as delimiter. It will need a TRIM too to cope with possible existence of spaces:

=TRIM(REPLACE(A1,1,SEARCH("@",SUBSTITUTE(A1,",","@",LEN(A1)-LEN(SUBSTITUTE(A1,",","")))),""))
 
Upvote 0

Forum statistics

Threads
1,215,032
Messages
6,122,772
Members
449,095
Latest member
m_smith_solihull

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