Return value from another cell when value(s) is present as part of a string

Georgez

New Member
Joined
Jun 10, 2016
Messages
8
Office Version
  1. 365
Platform
  1. Windows
Hello Experts.
I appreciate any help you can provide. I am trying to list users Secretaries in a spreadsheet
I have a spreadsheet containing user information (initials, name, title etc). If the user is a Secretary, their title includes the initials of the people they work for separated by a comma.
I need to generate the Secretaries initials against the users based on the presence of the users initials in the Secretaries titles. NB some users have more than one secretary.
I am able to use INDEX / MATCH but can't work out how to do this in this scenario, when the users initials are part of a string, and have possible multiple matches.
I have attached an image of some dummy records to illustrate. I am trying to generate the information held in column G.
Many thanks for any guidance.
 

Attachments

  • Sample.JPG
    Sample.JPG
    57 KB · Views: 22
  • Sample.JPG
    Sample.JPG
    57 KB · Views: 23

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
I am using Office 365. Full version below:
Microsoft® Excel® for Microsoft 365 MSO (Version 2308 Build 16.0.16731.20496) 32-bit
 
Upvote 0
One question, would you mind having a user-defined function (UDF) in VBA?
Or does it have to be pure Excel?

I have tried some things, but even with some Array Functions I could not get a result yet.
The "multiple matches" thing seems challenging.

I already figured out how to get the first Secretary for a user, but not yet if there are more.
So before I try something else, let me know if you're OK with some VBA.
 
Upvote 0
I am using Office 365. Full version below:
Microsoft® Excel® for Microsoft 365 MSO (Version 2308 Build 16.0.16731.20496) 32-bit
With that said, give this a try:
Book1
ABCDEFG
1ReferenceFirst NameLast NameDisplay NameEmailRoleSec Ref
2ABCTrainee SolicitorXYZ / SLT
3BCDPartner 
4XYZDeputy ASSM / Secretary to ABC, RFS 
5STHParalegal 
6MANParalegalSLT
7SLTSecretary to MAN, RAW, ABC 
8RFSSenior AssociateXYZ
9RAWAssociateSLT
Sheet1
Cell Formulas
RangeFormula
G2:G9G2=IFERROR(TEXTJOIN(" / ",TRUE,FILTER($A$2:$A$9,ISNUMBER(SEARCH(A2,$F$2:$F$9)))),"")
 
Upvote 0
Thank you everyone! I am happy with VBA if that's what it takes.
@dreid1011 many thanks for your code. This is great, and is working however if a job title contains the text string it is also bringing back a match. Eg MAR will be a hit on anyone with "Marketing" in their title. All the user initials are three characters so is it possibel to limit the match to three characters or inlcude ", " in the criteria?
Thanks again!
 
Upvote 0
I am using Office 365.

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
How about
Excel Formula:
=TEXTJOIN(" / ",TRUE,FILTER($A$2:$A$9,ISNUMBER(SEARCH(" "&A2&","," "&$F$2:$F$9&",")),""))
 
Upvote 0
Solution
Thank you everyone! @Fluff - your suggestion has done the trick. Thank you and everyone else for your expertise!
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,912
Messages
6,175,344
Members
452,638
Latest member
Oluwabukunmi

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