You are here:

Excel/Nested IF with AND function

Advertisement


Question
QUESTION: Hi Tom,

I have the below scenario. I need a formula to show the output as described below

Data:

Column H
H2
H3
H4
H5
H6

Condition:
(i)If the values in H2 till H6 is less than 100 then "Proceed".
(ii)If the value in any of the cells is more than 50000 and the value in remaining cells is 0 then "obtain approval"
(iii)If the value in any of the cells is above 100 and the value in none of the cells is 0, then "obtain approval"
(iv)if the value in all the cells is above 100 then obtain approval.

Thanks in advance
Sudharshan S

ANSWER: Sudharshan S,

I would see the formula being like this:

=IF(COUNTIF(H2:H6,"<100")=5,"Proceed",IF(OR(COUNTIF(H2:H6,">50000")+COUNTIF(H2:H6,0)=5,AND(COUNTIF(H2:H6,">100")>1,COUNTIF(H2:H6,0)=0),COUNTIF(H2:H6,">100")=5),"Obtain Approval","No condition met"))

You do seem to have some overlapping conditions.  Also never said less than or equal to or greater than or equal to.  In case you had 50000 in one cell and zeros in another, that would not meet condition ii.  Note that condition iv is a subset of condition iii

--
Regards,
Tom Ogilvy



---------- FOLLOW-UP ----------

Conditions
Conditions  
QUESTION: Hi Tom,

Thanks for your response.

But the formula doesn't seem to work, May be am not too clear with the question.

I have attached a screen print which will elaborate my question.

Regards,
Sudharshan

Answer
Case 1
(i)If the values in H2 till H6 is less than 100 then "Proceed".
you show 0, 90, 41,000, 0, 0   so 41,000 is not less than 100 and Case 1 is not met according to your statement.   Neither Proceed or Obtain should be returned and the formula correctly returns neither.  [formula works]

Case 2
(ii)If the value in any of the cells is more than 50000 and the value in remaining cells is 0 then "obtain approval"
you show 0, 90, 51000, 0, 0   so 90 is not zero and the condition is not met.  Neither Proceed or Obtain should be returned and the formula correctly returns neither. [formula works]

Case 3
(iii)If the value in any of the cells is above 100 and the value in none of the cells is 0, then "obtain approval"
you show 110, 200, 300, 200, 150.  This condition is met.  The formula returns Obtain approval so the formula works here when the specified conditions are met.  [formula works]

Case 4
(iv)if the value in all the cells is above 100 then obtain approval.
you show 110, 200, 42000, 40000, 10000.  This condition is met.  The formula returns Obtain approval so the formula works here when the specified conditions are met.  (in fact, as I stated, this example also satisfied rule (iii)).  [formula works]

so you have given two examples which don't meet your specified criteria and claimed the formula doesn't work.  The formula works with the criteria you stated.

--
Regards,
Tom Ogilvy  
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

Excel

All Answers


Answers by Expert:


Ask Experts

Volunteer


Tom Ogilvy

Expertise

Selected as an Excel MVP by Microsoft since 1999. Answering Excel questions in Allexperts since its inception in 2001. Able to answer questions on almost all aspects of Excel's internal capabilities. If seeking a VBA solution, please specify that in your question itself so I give you the answer you want. [Excel has weak protection - if you are distributing an application, I don't answer questions on how to protect your project from your users.]

Experience

Extensive experience.

Education/Credentials
Master of Science (MS) degree Operations Research (ORSA)

Awards and Honors
Microsoft MVP in Excel.

©2016 About.com. All rights reserved.