If/Then Contains Formula

squeakums

Well-known Member
Joined
May 15, 2007
Messages
851
Office Version
  1. 365
I am trying to figure out how to write and if/then contains formula.

If cell AD2 contains a what is below in the left column then place in current cell what is in right column? Like a vlookup off a contains formula.

Job Profile (contains)Archetype
Risk AdvisRisk Advisory
Risk ProgramRisk Program Execution
Governance & reportingGovernance & Reporting
Controls monitor, Issue validatControls Monitoring & Issue Validation
Business continuityBusiness Continuity / Incident Management
Officer, reporting to Joseph ThompsonSr. GCO
OtherEverything else
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Your question is vague. Can you show an example?
 
Upvote 0
Hello,

If I understand correctly, supposing the table you posted is named Table1, and the value to be compared is in AD2, i think the formula below should work?

Excel Formula:
=XLOOKUP(AD2,Table1[Job Profile (contains)],Table1[Archetype],"Everything else",0)
Nota: You do not need the "Other" row at the end, it is handled by XLOOKUP 4th argument=default value.
 
Upvote 0

Attachments

  • 1734011920810.png
    1734011920810.png
    47.2 KB · Views: 5
Upvote 0
Hello,

If I understand correctly, supposing the table you posted is named Table1, and the value to be compared is in AD2, i think the formula below should work?

Excel Formula:
=XLOOKUP(AD2,Table1[Job Profile (contains)],Table1[Archetype],"Everything else",0)
Nota: You do not need the "Other" row at the end, it is handled by XLOOKUP 4th argument=default value.

I do not understand your code for the table, its just an array. How would I write it as an array?

1734012327875.png
 
Upvote 0
Try:
Book1
ABCDE
1FormulaJob ProfileJob Profile (contains)Archetype
2Risk AdvisorySr. Risk Advisor CapRisk AdvisRisk Advisory
3Risk Program ExecutionRisk Program Execution IIIRisk ProgramRisk Program Execution
4Controls Monitoring & Issue ValidationControls Monitoring MangagerGovernance & reportingGovernance & Reporting
5Controls Monitoring & Issue ValidationIssue Validation ManagerControls monitorControls Monitoring & Issue Validation
6Risk AdvisoryJr. Risk Advisor IIIssue ValidationControls Monitoring & Issue Validation
7Business Continuity / Incident ManagementBusiness Continuity IIBusiness continuityBusiness Continuity / Incident Management
8OtherETA BuilderOfficer, reporting to Joseph ThompsonSr. GCO
9OtherOfficer Of CEO
10Risk Program ExecutionRisk Program Manager II
Sheet2
Cell Formulas
RangeFormula
A2:A10A2=IFERROR(TOCOL(IF(SEARCH($D$2:$D$8,B2),$E$2:$E$8),2),"Other")
 
Upvote 0
Solution
Try:
Book1
ABCDE
1FormulaJob ProfileJob Profile (contains)Archetype
2Risk AdvisorySr. Risk Advisor CapRisk AdvisRisk Advisory
3Risk Program ExecutionRisk Program Execution IIIRisk ProgramRisk Program Execution
4Controls Monitoring & Issue ValidationControls Monitoring MangagerGovernance & reportingGovernance & Reporting
5Controls Monitoring & Issue ValidationIssue Validation ManagerControls monitorControls Monitoring & Issue Validation
6Risk AdvisoryJr. Risk Advisor IIIssue ValidationControls Monitoring & Issue Validation
7Business Continuity / Incident ManagementBusiness Continuity IIBusiness continuityBusiness Continuity / Incident Management
8OtherETA BuilderOfficer, reporting to Joseph ThompsonSr. GCO
9OtherOfficer Of CEO
10Risk Program ExecutionRisk Program Manager II
Sheet2
Cell Formulas
RangeFormula
A2:A10A2=IFERROR(TOCOL(IF(SEARCH($D$2:$D$8,B2),$E$2:$E$8),2),"Other")
Yes this works, thank you :)
 
Upvote 0
Try:
Book1
ABCDE
1FormulaJob ProfileJob Profile (contains)Archetype
2Risk AdvisorySr. Risk Advisor CapRisk AdvisRisk Advisory
3Risk Program ExecutionRisk Program Execution IIIRisk ProgramRisk Program Execution
4Controls Monitoring & Issue ValidationControls Monitoring MangagerGovernance & reportingGovernance & Reporting
5Controls Monitoring & Issue ValidationIssue Validation ManagerControls monitorControls Monitoring & Issue Validation
6Risk AdvisoryJr. Risk Advisor IIIssue ValidationControls Monitoring & Issue Validation
7Business Continuity / Incident ManagementBusiness Continuity IIBusiness continuityBusiness Continuity / Incident Management
8OtherETA BuilderOfficer, reporting to Joseph ThompsonSr. GCO
9OtherOfficer Of CEO
10Risk Program ExecutionRisk Program Manager II
Sheet2
Cell Formulas
RangeFormula
A2:A10A2=IFERROR(TOCOL(IF(SEARCH($D$2:$D$8,B2),$E$2:$E$8),2),"Other")
May I ask what if there a multiple contains is there a way to write a formula for this? for example

Job Profile (contains)Clarifiers
"FINRA" and "man"FIN - Leadership
"FINRA", does not contain "man"FIN - Execution
 
Upvote 0
Show some examples of the Job Profiles in B.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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