IIF Statements

cooh23

Registered User.
Local time
Today, 11:18
Joined
Dec 5, 2007
Messages
169
Good Afternoon All,

I am having a problem with my IIF Statement below:
Code:
=IIf(IsNull([txtStandard]),"None",IIf([txtitemsperhour]>[txtstandard],"Exceeds Expectations",IIf([txtitemsperhour]<[txtstandard],"Below Expectations",IIf([txtitemsperhour]=[txtstandard],"Meets Expectations"))))

What I want to happen is that if:
[txtStandard] is Null, then show "None"
[txtitemsperhour]>[txtstandard] then show "Exceed Expectations"
[txtitemsperhour]<[txtstandard] then show "Below Expectations"
[txtitemsperhour]=[txtstandard] Then show "Meets Expectations"

What am I doing wrong here?
With the above code, if txtstandard is blank, it shows "Exceeds expectations"

Thank you,
 
Instead of this

IsNull([txtStandard])

try this

Nz([txtStandard], "") = ""
 
Instead of this

IsNull([txtStandard])

try this

Nz([txtStandard], "") = ""

Hi,
Here is now what I have
Code:
=IIf(Nz([txtStandard],"")="",IIf([txtitemsperhour]>[txtstandard],"Exceeds Expectations",IIf([txtitemsperhour]<[txtstandard],"Below Expectations",IIf([txtitemsperhour]=[txtstandard],"Meets Expectations"))))
What happens now is that anything with an entry under [txtstandard] becomes blank and the ones that are null have "exceeds Expectations"

It should be
for example:
Code:
txtstandard    txtitemsperhour    Outcome
6                     5                    Below Expectation
                      5                    None
4                    6                  Exceeds Expectations
Thank you,
 
Last edited:
Instead of this

IsNull([txtStandard])

try this

Nz([txtStandard], "") = ""


I played around with it and got it to work. Here's the code:

Code:
=IIf(Nz([txtStandard],"")="","None",IIf([txtitemsperhour]>[txtstandard],"Exceeds Expectations",IIf([txtitemsperhour]<[txtstandard],"Below Expectations",IIf([txtitemsperhour]=[txtstandard],"Meets Expectations"))))

Thank you for your assistance. I wouldn't have figured it out without your help. Thank you again.
 
=IIf(Nz([txtStandard],"")="","None",IIf([txtitemsperhour]>[txtstandard],"Exceeds Expectations",IIf([txtitemsperhour]<[txtstandard],"Below Expectations","Meets Expectations")))

The final IIf is not necessary. Hope I got the parentheses paired.
 
=IIf(Nz([txtStandard],"")="","None",IIf([txtitemsperhour]>[txtstandard],"Exceeds Expectations",IIf([txtitemsperhour]<[txtstandard],"Below Expectations","Meets Expectations")))

The final IIf is not necessary. Hope I got the parentheses paired.

That makes the code even more efficient. Thank you!
 

Users who are viewing this thread

Back
Top Bottom