nested iif not working!!!!

B

Becky

I have an nested IIF that will only display one vlaue in my report section
footer. I am sure that this is a simple ( ) problem or something, but it is
very frustrating!

Here is the statement: =IIf((([combo16]="24"),"Total for Section
24"),IIf(([combo16]="DLSS"),"Total for DLSS"),IIf((([combo16]="DTS"),"Total
for DTS"),"Total for Section 65H"))

Here is the explanation:
Combo16 has 4 choices. My report is grouped by these choices. I have a
running total at each grouping. I want it to display Total for Section 24,
Total for 65H, Total for DLSS, etc but it only dispalys Total for DLSS in
that section-the rest are blank.
 
D

David F Cox

you want the alternatives in the else sections. You have your brackets mixed
up.
untested:
=IIf([combo16]="24","Total for Section
24",IIf([combo16]="DLSS"),"Total for DLSS",IIf([combo16]="DTS"),"Total
for DTS","Total for Section 65H")))
 
J

John Vinson

I have an nested IIF that will only display one vlaue in my report section
footer. I am sure that this is a simple ( ) problem or something, but it is
very frustrating!

Here is the statement: =IIf((([combo16]="24"),"Total for Section
24"),IIf(([combo16]="DLSS"),"Total for DLSS"),IIf((([combo16]="DTS"),"Total
for DTS"),"Total for Section 65H"))

Here is the explanation:
Combo16 has 4 choices. My report is grouped by these choices. I have a
running total at each grouping. I want it to display Total for Section 24,
Total for 65H, Total for DLSS, etc but it only dispalys Total for DLSS in
that section-the rest are blank.

Try using the Switch() function instead; it takes arguments in pairs,
and reads them left to right. When it first encounters a pair where
the first argument is True, it returns the second member of the pair
and quits:

=Switch([Combo16] = "24", "Total For Section 24", [Combo16] = "DLSS",
"Total for DLSS", [Combo16] = "DTS", "Total for DLSS", True, "Total
for Section 65H")

John W. Vinson[MVP]
 
B

Becky

Thank you for your answers....

For some reason the nested iif would still not work. I have never had one
not work like that, so I was surprised.

However, the switch worked like a dream! I guess I am going to have to
research those some more!

John Vinson said:
I have an nested IIF that will only display one vlaue in my report section
footer. I am sure that this is a simple ( ) problem or something, but it is
very frustrating!

Here is the statement: =IIf((([combo16]="24"),"Total for Section
24"),IIf(([combo16]="DLSS"),"Total for DLSS"),IIf((([combo16]="DTS"),"Total
for DTS"),"Total for Section 65H"))

Here is the explanation:
Combo16 has 4 choices. My report is grouped by these choices. I have a
running total at each grouping. I want it to display Total for Section 24,
Total for 65H, Total for DLSS, etc but it only dispalys Total for DLSS in
that section-the rest are blank.

Try using the Switch() function instead; it takes arguments in pairs,
and reads them left to right. When it first encounters a pair where
the first argument is True, it returns the second member of the pair
and quits:

=Switch([Combo16] = "24", "Total For Section 24", [Combo16] = "DLSS",
"Total for DLSS", [Combo16] = "DTS", "Total for DLSS", True, "Total
for Section 65H")

John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top