Why is my OR Code Failing

Excel_77

Active Member
Joined
Sep 15, 2016
Messages
311
Office Version
  1. 2019
Platform
  1. Windows
Hi,

Can anyone correct this? My code is not quite working and it appears to be a problem with my OR sections, can anyone correct this?

=IF(AND(AZ2="ID",ISNUMBER(SEARCH("Com [L5]",AL2))=FALSE),"Investment",IF(OR(AZ2="Global Consumer",AL2="Commercial too"),"Retail ",IF(AND(AK2="Activities [L4]",ISNUMBER(SEARCH("Audit [L5]",OR("Risk",OR("Independent")),AL2))=FALSE),"Corporate",IF(AND(AK2="Activities [L4]",ISNUMBER(SEARCH("Audit [L5]",OR("Risk",OR("Independent")),AL2))=TRUE),"Independent"))))
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
The issue is within your 2nd and 3rd AND statements where you use the SEARCH function. As written they are invalid (doesn't inherently allow for multiple search parameters). Replace the ISNUMBER(SEARCH) portions with SUMPRODUCT(--ISNUMBER(SEARCH({"Audit[L5]","Risk","Independent"},AL2)))>0 [this will return TRUE or FALSE and can be paired with your existing logic check in those areas].

Reference this page if you want more on the topic: https://exceljet.net/formula/cell-contains-one-of-many-things
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,187
Members
453,020
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