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

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
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,226,114
Messages
6,189,052
Members
453,522
Latest member
Seeker2025

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