Multiple IIf Statement Structure

  • Thread starter Thread starter SigiS
  • Start date Start date
One structure would be:
IIF(Test,TruePart,IIF(AnotherTest,TruePart,IIF(AnotherTest,TruePart,FalsePart)))

A variation on that:
IIF(Test,IIF(AnotherTest,TruePart,IIF(AnotherTest,TruePart,FalsePart)),FalsePart)

Other variations are possible:
IIF(Test,IIF(Test,TruePart,FalsePart),IIF(Test,TruePart,FalsePart))

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
 
thank you!

John Spencer said:
One structure would be:
IIF(Test,TruePart,IIF(AnotherTest,TruePart,IIF(AnotherTest,TruePart,FalsePart)))

A variation on that:
IIF(Test,IIF(AnotherTest,TruePart,IIF(AnotherTest,TruePart,FalsePart)),FalsePart)

Other variations are possible:
IIF(Test,IIF(Test,TruePart,FalsePart),IIF(Test,TruePart,FalsePart))

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
 
Can some tell me what is the structure of a multiple IIf statement?

John's answered your direct question but... often it's clearer and more
efficient to avoid using nested IIF's. Instead you can consider the Switch
function; it takes an arbitrary number (dozens at least) of pairs of
arguments, evaluates them left to right, and when it first encounters a pair
with a TRUE value in the first member of the pair it returns the second. E.g.

Switch([Grade] > 92, "A", [Grade] > 84, "B", "Grade" > 76, "C", [Grade] > 68,
"D", True, "F")
 
Back
Top