IF nested query

Deelof

New Member
Joined
Aug 30, 2023
Messages
34
Office Version
  1. 2019
Platform
  1. Windows
What's the best formula for the below criteria to return specific text as the Action column?

If "On Web" and Stock is less than or equal to 2 and Core or Non Core = "False", "Remove from Web"
And
If "On Web" and Stock is equal to 0 but Core or Non Core = "True", "Leave on Web"
And
If "Not on Web", stock is greater than 2 - "Data Checks"
And ignore any blanks in the Web Status column, returning a blank Action

WEB STATUSCORENON CORESTOCKACTION
ON WEBFALSEFALSE2REMOVE FROM WEB
ON WEBFALSEFALSE5LEAVE ON WEB
ON WEBFALSETRUE0NON CORE - LEAVE ON WEB
ON WEBFALSETRUE1NON CORE - LEAVE ON WEB
ON WEBFALSETRUE0NON CORE - LEAVE ON WEB
ON WEBFALSETRUE0NON CORE - LEAVE ON WEB
ON WEBFALSETRUE0NON CORE - LEAVE ON WEB
ON WEBFALSETRUE0NON CORE - LEAVE ON WEB
ON WEBFALSETRUE0NON CORE - LEAVE ON WEB
ON WEBFALSEFALSE0REMOVE FROM WEB
ON WEBFALSEFALSE10LEAVE ON WEB
NOT ON WEBFALSEFALSE32DATA CHECKS
NOT ON WEBFALSEFALSE20DATA CHECKS
ON WEBTRUEFALSE0LEAVE ON WEB
ON WEBFALSEFALSE6LEAVE ON WEB
ON WEBFALSEFALSE12LEAVE ON WEB
ON WEBFALSEFALSE7LEAVE ON WEB
ON WEBTRUEFALSE1CORE - LEAVE ON WEB
ON WEBTRUEFALSE9CORE - LEAVE ON WEB
ON WEBFALSETRUE0NON CORE - LEAVE ON WEB
 
I understand your request as follows:

  • If at least 1 TRUE, regardless of stock: Core or Noncore
  • else, if stock <= 2: "Remove"
  • else, if "NOT ON WEB", "Check", else, "Leave"
  • In your explanation, there is no case for ("NOT ON WEB" and stock <= 2), so I assume it is "Remove" (stock <= 2).
Book1
ABCDE
1WEB STATUSCORENON CORESTOCK
2ON WEBFALSEFALSE2Remove from Web
3ON WEBFALSEFALSE5Leave on Web
4ON WEBFALSETRUE0Non Core -Leave on Web
5ON WEBFALSETRUE1Non Core -Leave on Web
6ON WEBFALSETRUE0Non Core -Leave on Web
7ON WEBFALSETRUE0Non Core -Leave on Web
8ON WEBFALSETRUE0Non Core -Leave on Web
9ON WEBFALSETRUE0Non Core -Leave on Web
10ON WEBFALSETRUE0Non Core -Leave on Web
11ON WEBFALSEFALSE0Remove from Web
12ON WEBFALSEFALSE10Leave on Web
13NOT ON WEBFALSEFALSE32Date Checks
14NOT ON WEBFALSEFALSE20Date Checks
15ON WEBFALSEFALSE3Leave on Web
16ON WEBFALSEFALSE6Leave on Web
17ON WEBFALSEFALSE12Leave on Web
18ON WEBFALSEFALSE7Leave on Web
19ON WEBTRUEFALSE1Core - Leave on Web
20ON WEBTRUEFALSE9Core - Leave on Web
21ON WEBFALSETRUE0Non Core -Leave on Web
Sheet1
Cell Formulas
RangeFormula
E2:E21E2=IFERROR(CHOOSE(MATCH(TRUE,B2:C2,0),"Core - ","Non Core -") & "Leave on Web",IF(D2<=2,"Remove from Web",IF(LEFT(A2,3)="NOT","Date Checks","Leave on Web")))
Thank you!
What if B and C hold vlookup as below to another tab and return blank, action result required here would be blank?

=IF($I4="","",IF(ISNA(VLOOKUP($I4,'Core & Core Non stock range'!$B:$G,5,FALSE)),"",VLOOKUP($I4,'Core & Core Non stock range'!$B:$G,5,FALSE)))
 
Upvote 0

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
What's the best formula for the below criteria to return specific text as the Action column?

If "On Web" and Stock is less than or equal to 2 and Core or Non Core = "False", "Remove from Web"
And
If "On Web" and Stock is equal to 0 but Core or Non Core = "True", "Leave on Web"
And
If "Not on Web", stock is greater than 2 - "Data Checks"
And ignore any blanks in the Web Status column, returning a blank Action

WEB STATUSCORENON CORESTOCKACTION
ON WEBFALSEFALSE2REMOVE FROM WEB
ON WEBFALSEFALSE5LEAVE ON WEB
ON WEBFALSETRUE0NON CORE - LEAVE ON WEB
ON WEBFALSETRUE1NON CORE - LEAVE ON WEB
ON WEBFALSETRUE0NON CORE - LEAVE ON WEB
ON WEBFALSETRUE0NON CORE - LEAVE ON WEB
ON WEBFALSETRUE0NON CORE - LEAVE ON WEB
ON WEBFALSETRUE0NON CORE - LEAVE ON WEB
ON WEBFALSETRUE0NON CORE - LEAVE ON WEB
ON WEBFALSEFALSE0REMOVE FROM WEB
ON WEBFALSEFALSE10LEAVE ON WEB
NOT ON WEBFALSEFALSE32DATA CHECKS
NOT ON WEBFALSEFALSE20DATA CHECKS
ON WEBTRUEFALSE0LEAVE ON WEB
ON WEBFALSEFALSE6LEAVE ON WEB
ON WEBFALSEFALSE12LEAVE ON WEB
ON WEBFALSEFALSE7LEAVE ON WEB
ON WEBTRUEFALSE1CORE - LEAVE ON WEB
ON WEBTRUEFALSE9CORE - LEAVE ON WEB
ON WEBFALSETRUE0NON CORE - LEAVE ON WEB
Further to this, how about if Core or Core Non Stock and Web Status = Not on Web? I'd like the Action response to be "Data" Checks".

If "On Web" and Stock is less than or equal to 2 and Core or Non Core = "False", "Remove from Web"
And
If "On Web" and Stock is equal to 0 but Core or Non Core = "True", "Leave on Web"
And
If "Not on Web", stock is greater than 2 - "Data Checks"
And ignore any blanks in the Web Status column, returning a blank Action
 
Upvote 0

Forum statistics

Threads
1,215,764
Messages
6,126,748
Members
449,335
Latest member
Tanne

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