Else #Error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Please help me figure out why I keep getting #Error for the else part below:
Benefits: IIf([C_Benefits]=0,[Budget]*0.0765,[Budget]*0.1747)

C_Benefits is text, and when the condition is true the first part works
fine. It's when C_Benefits <> 0 I get "#Error" as a result.

Thanks in advance for your help.
 
Dear Stacy:

Since C_Benefits is text, try changing to:

IIf([C_Benefits] = "0", [Budget] * 0.0765, [Budget] * 0.1747)

I think that the comparison to a numeric value is causing C_Benefits to be
converted from text to a numeric value. When the text is numeric, this is
OK, but when it says "George" (or anything else not a text representation of
a numeric value) then it errors. Makes sense to me, anyway.

Tom Ellison
 
Do you have cases when the [Budget] is Null?

If you do try changing the Null to 0 by using the Nz Function

Benefits: IIf([C_Benefits]="0",Nz([Budget],0)*0.0765,Nz([Budget],0)*0.1747)
 
Back
Top