if statement

  • Thread starter Thread starter ty
  • Start date Start date
T

ty

In a select query, can I place an if statement for a
calculated field. If so I need one that says if MyCount =
0, then return "Not Applicable", else [MyValue]/[MyCount].

I'm basically calculating a percentage, but can't do it if
the MyCount is zero.
 
Exp: IIf(MyCount = 0,"Not Applicable",MyValue/MyCount)

The next line will also convert a Null to 0 and then work as above:

Exp:IIf(Nz(MyCount,0) = 0,"Not Applicable",MyValue/MyCount)

Take your pick.
 
Back
Top