Multiple If/then formula if contains

squeakums

Well-known Member
Joined
May 15, 2007
Messages
851
Office Version
  1. 365
I have this basic formula:

=IF(cell="text", value_to_return, "").

Id like to write a formula that is more like =if(cell="FINRA" and "man", "Leadership), if(cell="FINRA" and <> "man", then "Execution", if(cell=<>"Finra" and "Manager, "leadership), if(cell="executive assistant", "admin") otherwise "Execution".

How would I write this multiple if/then statement for containing words please?
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
I think there are some logic problems with your mock-formula, the way you structured it (it is not a valid nested formula format, at least not one that makes any logical sense). So we really cannot tell what exactly you want to happen.

Can we come at this a different way, and can you provide a list that shows what value should be returned in which conditions?

For example:
SituationConditionsReturn
1Column A is "Man" and Column B is "Dog"abc
2Column A is "Man" and Column B is "Cat"lmn
3Column A is "Child" and Column B is "Cat"xyz
 
Upvote 0
I think there are some logic problems with your mock-formula, the way you structured it (it is not a valid nested formula format, at least not one that makes any logical sense). So we really cannot tell what exactly you want to happen.

Can we come at this a different way, and can you provide a list that shows what value should be returned in which conditions?

For example:
SituationConditionsReturn
1Column A is "Man" and Column B is "Dog"abc
2Column A is "Man" and Column B is "Cat"lmn
3Column A is "Child" and Column B is "Cat"xyz
This is looking at one cell. I used an array before but this one might not work with that array because it has multiple contains:

If Contains this in the cell D2What it should Create for the Formula Cell
"FINRA" and "man"FINRA - Leadership
"FINRA", <> "man"FINRA - Execution
Filter FINRA out, then search Manager, <> contingentLeadership
Executive AssistantAdmin
Manager-FINRAFINRA - Leadership
OfficerLeadership
"FINRA" and "Leader"FINRA - Leadership
Administrative AssistantAdmin
If not of the above then Execution
 
Upvote 0
You only reference 1 cell in that chart. Are you looking for each of those words mixed with other text?
 
Upvote 0
You only reference 1 cell in that chart. Are you looking for each of those words mixed with other text?
Correct, it is several lookups in the cell to determine which bucket it falls under. Then, the formula is filled down.
 
Upvote 0
Thank you. It sounds like we are doing partial matches then, right?
Just to confirm that, for each item in the list, can you show us a complete entry in cell D2 would look like?

So, maybe the first one looks like:
"I am a man who works for FINRA".
and the second may look like:
"I work for FINRA".

I see some potential issues where you could have overlaps (entries that meet the criteria for two or more items in your list).
For example, an entry like:
"I am the Leader of FINRA"
meets the criteria for both of your rules:
"FINRA", <> "man"
"FINRA" and "Leader"


If that is the case, is there some sort of hierarchy (where certain rules/conditions take precedence over others)?
 
Upvote 0
Thank you. It sounds like we are doing partial matches then, right?
Just to confirm that, for each item in the list, can you show us a complete entry in cell D2 would look like?

So, maybe the first one looks like:
"I am a man who works for FINRA".
and the second may look like:
"I work for FINRA".

I see some potential issues where you could have overlaps (entries that meet the criteria for two or more items in your list).
For example, an entry like:
"I am the Leader of FINRA"
meets the criteria for both of your rules:
"FINRA", <> "man"
"FINRA" and "Leader"


If that is the case, is there some sort of hierarchy (where certain rules/conditions take precedence over others)?
They aren't sentences, they are long job titles that we are trying to bucket. So, it would either be xxxxxx..xxxxx finra leader or xxxxx.xxxxx finra manager or sometimes spelled finra manger b/c space runs out.
 
Upvote 0
Please show me examples of each one, like I asked.
 
Upvote 0
Here you are:


If Contains this in the cell D2If it finds this contain what formula producesField D2 its searching for textIf formula was in this cell what it would produce; Results
"FINRA" and "man"FINRA - LeadershipRooms to Go - FINRA-ManagerFINRA - Leadership
"FINRA", <> "man"FINRA - ExecutionRooms to Go - FINRA AssociateFINRA - Execution
Filter FINRA out, then search ManagerLeadershipRooms to Go - ManagerLeadership
Executive AssistantAdminShopping Executive AssistantAdmin
Manager-FINRAFINRA - LeadershipSPOC Manager-FINRAFINRA - Leadership
OfficerLeadershipFinancial OfficerLeadership
"FINRA" and "Leader"FINRA - LeadershipSPOC FINRA - LeaderFINRA - Leadership
Administrative AssistantAdminSPOC Administrative AssistantAdmin
If not of the above thenExecutionRooms to Go EmployeeExecution
Advisor IIExecution
 
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