Multiple Ifs, Ands, and Ors in one formula

Chevon

New Member
Joined
Mar 25, 2019
Messages
5
I am trying to make one formula that can incorporate many ifs, ands, and ors. Here are my individual statements:
If D13 or H13 is “Lead” or “Lead-lined” then K13 should be “Lead”

If D13 and H13 contain “Non-Lead” then K13 should be “Non-Lead”

If D13 and H13 contain “Unknown” then K13 should be “Unknown”

If D13 contains “Unknown” and H13 contains “Non-Lead” then K13 should be “Unknown”

If H13 contains “Unknown” and D13 contains “Non-Lead” then K13 should be “Unknown”
 

Attachments

  • Screenshot 2024-09-24 100442.jpg
    Screenshot 2024-09-24 100442.jpg
    112.8 KB · Views: 8

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Try
Excel Formula:
=IF(left(D13,8)&left(H13,8)=“Non-LeadNon-Lead”,“Non-Lead”,"Unknown")
 
Last edited:
Upvote 0
Sorry I missed your first situation
Modified formula:
Excel Formula:
=switch(left(D13,8)&left(H13,8),“Non-LeadNon-Lead”,“Non-Lead”,"LeadLead-lin","Lead","Lead-linLead","Lead","Unknown")
 
Upvote 0
Sorry I missed your first situation
Modified formula:
Excel Formula:
=switch(left(D13,8)&left(H13,8),“Non-LeadNon-Lead”,“Non-Lead”,"LeadLead-lin","Lead","Lead-linLead","Lead","Unknown")
Don't use "smart quotes" in formulas or code. Excel won't recognize them as quotes.


$scratch.xlsm
DEFGHIJK
1Desired ResultFormula Result
2LeadLeadLead
3LeadLeadLead
4Lead-linedLeadLead
5Lead-linedLeadLead
6Non-LeadNon-LeadNon-LeadNon-Lead
7UnknownUnknownUnknownUnknown
8UnknownNon-LeadUnknownUnknown
9Non-LeadUnknownUnknownUnknown
Sheet16
Cell Formulas
RangeFormula
K2:K9K2=IF(AND(D2="Non-Lead",H2="Non-Lead"),"Non-Lead",IF(OR(D2="Lead",H2="Lead",D2="Lead-Lined",H2="Lead-Lined"),"Lead","Unknown"))
 
Upvote 0
Solution
Sorry, I provided a formula before I opened your screenshot. I did not realize that they keywords were only part of the cell text. Can you paste in the actual data instead of a picture?
 
Upvote 0
Don't use "smart quotes" in formulas or code. Excel won't recognize them as quotes.
Not sure why the system put different type of quotes, I used the same button on my keyboard for all.
That being said, I tested my own formula in excel now 🙃 and modified it to work properly here:
Excel Formula:
=SWITCH(LEFT(D13,8)&LEFT(H13,8),"Non-LeadNon-Lead","Non-Lead","LeadLead-lin","Lead","Lead-linLead","Lead","Unknown")
 
Upvote 0

Forum statistics

Threads
1,223,875
Messages
6,175,116
Members
452,613
Latest member
amorehouse

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