You are missing the 1 (TRUE value for the [FSL]=1 test). It should be
Code:
=Sum(IIf(Nz([FSL],0)=1,1, IIf(Nz([Schedule_Status],0)="In AC Review",1,IIf(Nz([Schedule_Status],0)="In DC Review",1,IIf(Nz([Schedule_Status],0)="In LESPM Review",1,0)))))
This is how I build nested IF() statements. You have 4 IIF() statements. I start out with the basic syntax:
Code:
IIF(Cond,True,False)
Then I add the second IIF() statement in the False argument:
Code:
IIF(Cond,True,IIF(Cond,True,False))
Then the 3rd and 4th statements:
Code:
IIF(Cond,True,IIF(Cond,True,IIF(Cond,True,IIF(Cond,True,False))))
Next, I start replacing the cond (condition) arguments:
Code:
IIF(Nz([FSL],0)=1,True,IIF(Cond,True,IIF(Cond,True,IIF(Cond,True,False))))
If Nz([FSL],0)=1 is TRUE, I want a 1 returned, so now replace the True part with a 1:
Code:
IIF(Nz([FSL],0)=1,1,IIF(Cond,True,IIF(Cond,True,IIF(Cond,True,False))))
The 2nd condition is comparing strings, so for the NZ() function I would replace a NULL with a empty string instead of a zero. So now replace the 2nd cond with:
Code:
IIF(Nz([FSL],0)=1,1,IIF(IIf(Nz([Schedule_Status],"")="In AC Review",True,IIF(Cond,True,IIF(Cond,True,False))))
Replacing all of the arguments, you end up with:
Code:
IIF(Nz([FSL],0)=1,1,IIF(Nz([Schedule_Status],"")="In AC Review",1,IIF(Nz([Schedule_Status],"")="In DC Review",1,IIF(Nz([Schedule_Status],"")="In LESPM Review",1,0))))
And you want to use the Sum() function:
Code:
=Sum(IIF(Nz([FSL],0)=1,1,IIF(Nz([Schedule_Status],"")="In AC Review",1,IIF(Nz([Schedule_Status],"")="In DC Review",1,IIF(Nz([Schedule_Status],"")="In LESPM Review",1,0)))))
You have the formula you want with the correct number of parenthesis.
------------------
Unfortunately, your formula will return only a 1 or a zero. The Sum() function is useless. For example, if [FSL]=1 , a one will be returned. That is where it stops. The remaining IIF() functions (as the false value) will not be evaluated to return a value.
If you want to sum the results of the conditions, try:
Code:
=Sum(IIf(Nz([FSL], 0) = 1, 1, 0) + IIf(Nz([Schedule_Status], "") = "In AC Review", 1, 0) + IIf(Nz([Schedule_Status], "") = "In DC Review", 1, 0) + IIf(Nz([Schedule_Status], "") = "In LESPM Review", 1, 0))
Since 3 of the conditions are the same control name, you can also write it like this:
Code:
=Sum(IIF(Nz([FSL],0)=1,1,0) + IIF(Nz([Schedule_Status],"")="In AC Review" OR Nz([Schedule_Status],"")="In DC Review" OR Nz([Schedule_Status],"")="In LESPM Review",1,0))
Pretty long winded, just to tell you you are missing a 1....