Help expanding on this forumla for what I need

Narrian

New Member
Joined
May 7, 2024
Messages
3
Office Version
  1. 365
Platform
  1. Windows
=IF(ISNUMBER(SEARCH("Find_Text",H2)),"Value_if_True","")

Purpose, I need it to query a list of names not just 1 name, and output 2 different results based on a match. So for sake of example Employee names and then divided up into two different job roles. I'm sure Xlookup if going to be the route i'll have to take on this but I am lost as I am a beginner with excel formulas.

Any help would be greatly appreciated, thank you!
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Do you want to query "John Smith" and find where Column with "John" and Column with "Smith" matches in the "Job Role" column?
Are all names only two names? What if there are initials or a middle name, a prefix or a suffix? what if the person has two job roles?

the most basic of these would be
Excel Formula:
=XLOOKUP(TextBefore("Full Name"," ")&TextAfter("Full Name"," "),FirstNameColumn & LastNameColumn, JobRoleColumn,0)

Book1
ABCDEF
1Name:John Smith
2Role:CEOJohnJonesManger
3JohnSmithCEO
4BillSmithLaborer
Sheet1
Cell Formulas
RangeFormula
B2B2=XLOOKUP(TEXTBEFORE(B1," ")&TEXTAFTER(B1," "),D2:D4 & E2:E4, F2:F4,0)
 
Last edited:
Upvote 0
Do you want to query "John Smith" and find where Column with "John" and Column with "Smith" matches in the "Job Role" column?
Are all names only two names? What if there are initials or a middle name, a prefix or a suffix? what if the person has two job roles?
Only using First names, for this purpose they would only have 1 job code assigned. Column H as it stands now is conditionally formatted with a name list drop down, and are selected manually, I'm just looking for an output for Column D between the two "Roles".
 
Upvote 0
then change the above to:
Excel Formula:
=XLOOKUP(TEXTBEFORE(B1," "),D2:D4, F2:F4,0)

sorry my columns don't match yours. You'll need to edit them.


Also, this only gives one result. What is the 2nd you seek?
 
Upvote 0
Thank you I will play around with this when I get back to my computer.
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,631
Latest member
a_potato

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