excel - nested if condition formatting - excel

I was just wondering if this is the proper way to nest this many conditions. It does work, just looks like it could be written simpler.
=IF(H13>0,IF(H14>0,IF(H15>0,IF(H16>0,IF(H17>0,IF(H18>0,IF(H19>0,"Yes","No"),"No"),"No"),"No"),"No"),"No"),"No")

Above formula can be written as
=IF(COUNTIF(H13:H19,">0")=7,"Yes","No")

You can use AND
=IF(AND(H13>0,H14>0,H15>0,H16>0,H17>0,H18>0,H19>0),"Yes","No")
Also use OR
=IF(OR(H13<=0,H14<=0,H15<=0,H16<=0,H17<=0,H18<=0,H19<=0),"No","Yes")

Related

Two Texts in a Formula

Probably an incredibly easy change but I seem to have a brain fart in this. I have a column and I want my formula to search for both "Open" and "In-Transit".
=COUNTIFS('Warner Robins'!A:A,"Open",'Warner Robins'!G:G, "PAB")
perhaps:
=COUNTIFS('Warner Robins'!A:A,"Open",'Warner Robins'!G:G, "PAB")+COUNTIFS('Warner Robins'!A:A,"In-Transit",'Warner Robins'!G:G, "PAB")
Building an OR into a formula can be tough...........easier to just add up the cases.
Or you can go with this one:
=SUM(COUNTIFS('Warner Robins'!A:A,{"Open","In-Transit"},'Warner Robins'!G:G, "PAB"))
Generally makes it easier for multiple OR clauses.

How to include Multiple IFs in Excel formula?

I have the formula below that has two IF Statements however it is given an error. Any help is appreciated.
=IF((AND(B11>65,D15>65)),Sheet!D$47,VLOOKUP(D15,Sheet!$A$2:$K$51,4,FALSE)),IF((AND(B11>61,D15>61)),Sheet!D$44,VLOOKUP(D15,Sheet!$A$2:$K$51,4,FALSE))
What I am trying to Achieve is the following:
IF B11>65 and D15 >65 Then select value from D$47. IF B11<65 and D15<65 Then Select value from D$44. Else VLOOKUP(D15,Sheet!$A$2:$K$51,4,FALSE))
You can have multiple IF() calls embedded such as this:
=IF(AND(), Sheet!D$47, IF(AND(), Sheet!D$44, VLOOKUP())
The complete form in your case would be:
=IF(AND(B11>65,D15>65), Sheet!D$47, IF(AND(B11>61,D15>61), Sheet!D$44, VLOOKUP(D15,Sheet!$A$2:$K$51,4,FALSE)))
Basically, this uses the 'Else' clause as a means to add additional clauses. It is possible to do it the other way around but I personally find that harder to read.

Conditional median with or-clause

In another forum, I found a way to make a conditional median calculation in Excel work like this:
{=MEDIAN(IF(and(BN8:BN229<44,BN8:BN229>0),BM8:BM229))}
...becomes...
{=MEDIAN(IF($BN$8:$BN$229<44,IF(BN8:BN229>0,$BM$8:$BM$229)))}
...and works (due to the nested if-statements).
However, I need to do the same with an or-clause. How, would I do this?
Already found a way:
{=MEDIAN(IF($BN$8:$BN$229<44,$BM$8:$BM$229,IF(BN8:BN229>0,$BM$8:$BM$229)))}

Combining formulas using AND

I am trying to combine two forumlas into one.
They both work individually and I would like to make it so the condition is only met if both formulas are met. The forumlas are:
=IF(AND(Sheet2!$C$6>40,Sheet2!$C$6<=50),TRUE,FALSE)
=IF((INDIRECT(SUBSTITUTE(ADDRESS(1,COLUMN(),4),"1","3"))>=Sheet2!$B$6),TRUE,FALSE)
I have tried to use another AND clause but had no luck yet with this, would anyone be able to provide a consolidated formula for both of these?
the long way:
=IF(AND(Sheet2!$C$6>40,Sheet2!$C$6<=50,INDIRECT("R3C"&COLUMN(),)>=Sheet2!$B$6), TRUE, FALSE)
the short way:
=AND(Sheet2!$C$6>40,Sheet2!$C$6<=50,INDIRECT("R3C"&COLUMN(),)>=Sheet2!$B$6)
also possible:
=((Sheet2!$C$6>40)*(Sheet2!$C$6<=50)*(INDIRECT("R3C"&COLUMN(),)>=Sheet2!$B$6))=1
why the SUBSTITUTE(ADDRESS(1,COLUMN(),4),"1","3")??? just ADDRESS(3,COLUMN(),4) will be the same... also why address at all? justINDIRECT("R3C"&COLUMN(),) will also work
Compiling the comments, this should be the minimal formula gathering your tests :
=AND(Sheet2!$C$6>40,Sheet2!$C$6<=50,INDIRECT(SUBSTITUTE(ADDRESS(1,COLUMN(),4),"1","3"))>=Sheet2!$B$6)

Combining two IF condition in excel for a cell

I need help in combining two IF condition statements in excel. Both are working fine, just that when I try to combine them then I'm getting error. Below are the conditions:
=IF(AND(F19="No", NOT(OR(ISBLANK(B36),ISBLANK(B37),ISBLANK(D36),ISBLANK(D37),ISBLANK(B40),ISBLANK(D39),ISBLANK(F39),ISBLANK(D40),ISBLANK(F40),ISBLANK(B43),ISBLANK(B44),ISBLANK(B48),ISBLANK(B49),ISBLANK(B50),ISBLANK(B51),ISBLANK(B52)))),"Section Complete","Section Incomplete")
=IF(AND(F19="Yes", NOT(OR(ISBLANK(B36),ISBLANK(B37),ISBLANK(D36),ISBLANK(D37),ISBLANK(B40),ISBLANK(D39),ISBLANK(F39),ISBLANK(D40),ISBLANK(F40),ISBLANK(B43),ISBLANK(B44),ISBLANK(B48),ISBLANK(B49),ISBLANK(B50),ISBLANK(B51),ISBLANK(B52),ISBLANK(D43),ISBLANK(D44),ISBLANK(D45),ISBLANK(D46),ISBLANK(D47),ISBLANK(D48),))),"Section Complete","Section Incomplete")
Please help me in combining them.
Thanks in advance, Krishna
... I didn't try and make it prettier / more efficient - I just used your original formulas, but this should do what you want:
=IF(OR(AND(F19="No", NOT(OR(ISBLANK(B36),ISBLANK(B37),ISBLANK(D36),ISBLANK(D37),ISBLANK(B40),ISBLANK(D39),ISBLANK(F39),ISBLANK(D40),ISBLANK(F40),ISBLANK(B43),ISBLANK(B44),ISBLANK(B48),ISBLANK(B49),ISBLANK(B50),ISBLANK(B51),ISBLANK(B52)))),AND(F19="Yes", NOT(OR(ISBLANK(B36),ISBLANK(B37),ISBLANK(D36),ISBLANK(D37),ISBLANK(B40),ISBLANK(D39),ISBLANK(F39),ISBLANK(D40),ISBLANK(F40),ISBLANK(B43),ISBLANK(B44),ISBLANK(B48),ISBLANK(B49),ISBLANK(B50),ISBLANK(B51),ISBLANK(B52),ISBLANK(D43),ISBLANK(D44),ISBLANK(D45),ISBLANK(D46),ISBLANK(D47),ISBLANK(D48))))),"Section Complete","Section Incomplete")
Hope this does the trick!!
You could just as simple replace the "Section incomplete" in the first No-IF, by replacing it with the Yes-IF.
=IF(AND(F19="No";NOT(OR(ISBLANK(B36);ISBLANK(B37);ISBLANK(D36);ISBLANK(D37);ISBLANK(B40);ISBLANK(D39);ISBLANK(F39);ISBLANK(D40);ISBLANK(F40);ISBLANK(B43);ISBLANK(B44);ISBLANK(B48);ISBLANK(B49);ISBLANK(B50);ISBLANK(B51);ISBLANK(B52))));"Section Complete";IF(AND(F19="Yes";NOT(OR(ISBLANK(B36);ISBLANK(B37);ISBLANK(D36);ISBLANK(D37);ISBLANK(B40);ISBLANK(D39);ISBLANK(F39);ISBLANK(D40);ISBLANK(F40);ISBLANK(B43);ISBLANK(B44);ISBLANK(B48);ISBLANK(B49);ISBLANK(B50);ISBLANK(B51);ISBLANK(B52);ISBLANK(D43);ISBLANK(D44);ISBLANK(D45);ISBLANK(D46);ISBLANK(D47);ISBLANK(D48);)));"Section Complete";"Section Incomplete"))
Try simplifying with some COUNTA functions like this:
=IF(AND(COUNTA(B36,B37,D36,D37,B40,D39,F39,D40,F40,B43,B44,B48:B52)=16,OR(F19="No",AND(F19="Yes",COUNTA(D43:D48)=6))),"Section Complete","Section Incomplete")
That should combine the two formulas without repetition

Resources