Search code examples
excelexcel-formulaexcel-2010excel-2007

How to nest more IF conditions in excel when first condition becomes FALSE?


The excel not accepting the formula

=IF(AND(Sheet1!BZ2<>"",Sheet1!CB2<>"",Sheet1!CD2<>"",Sheet1!CF2<>"",Sheet1!CH2<>"",Sheet1!CA2="",Sheet1!BC2="B"), IF(Sheet1!CA2="","",TODAY()-1),
    IF(
        IF(AND(Sheet1!BZ2<>"",Sheet1!CA2="",Sheet1!BC2="A"),IF(Sheet1!CA2="","",TODAY()-1),
            IF(
                IF(AND(OR(Sheet1!DB2="Completed - Knowledge Transfer"),AND(Sheet1!BC2<>"")),IF(Sheet1!CA2="","",TODAY()-1),
                IF(Sheet1!CA2="","",Sheet1!CA2)
                  )
       )
  )

I am following the below syntax for IF .

=IF (logical_test, [value_if_true], [value_if_false])

I am trying to nest the other conditions whenever the statements gets FALSE Please help.

Can someone pls find the syntax error I am doing in this


Solution

  • The If statement isn't nested properly and also you are using some AND Or statements which are again not used properly.

    Simplifying your formula we get this

    =IF(a,b,IF(IF(c,d,IF(IF(e,f,g)))
    

    where ,

     a = AND(Sheet1!BZ2<>"",Sheet1!CB2<>"",Sheet1!CD2<>"",Sheet1!CF2<>"",Sheet1!CH2<>"",Sheet1!CA2="",Sheet1!BC2="B") 
    
     b = IF(Sheet1!CA2="","",TODAY()-1)
    
     c = AND(Sheet1!BZ2<>"",Sheet1!CA2="",Sheet1!BC2="A")
    
     d = IF(Sheet1!CA2="","",TODAY()-1)
    
     e = AND(OR(Sheet1!DB2="Completed - Knowledge Transfer"),AND(Sheet1!BC2<>""))This does not make sense
    
     f = IF(Sheet1!CA2="","",TODAY()-1)
    
     g = IF(Sheet1!CA2="","",Sheet1!CA2)
    

    A proper nested IF will be of the form

    =IF(a,b,IF(c,d,IF(e,f,g)))