View Full Version : IIf Statement


nhunt1
07-15-2002, 04:16 PM
I am getting the results I want with the following IIf statement; that is for these two types of Plans A or S, for any Begin Year, I get a returned value; however, for those Begin Years that are not Plan A or Plan S, I want the statement to enter the number 0.

IIf(([Plan Type]="A" Or [Plan Type]="S"),IIf(([Begin Year]<>0),IIf(([MetLife GA]>=6),2.1,IIf(([MetLife GA]<6),[MetLife GA]*0.35,0))))


:confused:

raskew
07-15-2002, 04:51 PM
To understand your problem, I tried reconstructing it using a snippet of code.

If the following is what you're trying to accomplish…

If instr("A S", [Plan Type]) >0 then
If [Begin Year] <> 0 then
If [MetLife GA] >= 6 then
Widget = 2.1
Else
Widget = [MetLife GA] * 0.35
End if
Else
Widget = 0
End if
Else
Widget = 0
End if

…then you could use the Switch() function, in combination with an Iif() statement


Switch(instr("A S", [Plan Type])>0 and BeginYear<>0, iif([MetLife GA]>= 6, 2.1, [MetLife GA]*0.35, True, 0)

nhunt1
07-15-2002, 07:57 PM
Raskew,
I will try this and let you know the outcome. Thanks so very much!