How to handle #Errror in a query

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

Guest

I have the following in a query and until some data comes at a later date it
will error out. Is it possible to use an IIF statement to return something
other than #error

Gross pct Change:
([Totals]![SumOfCY_Gross_Revenue]-[Totals]![SumOfLY_Gross_Revenue])/[Totals]![SumOfLY_Gross_Revenue]

Thank you for you assistance
 
Gross pct Change:
Iif(nz([Totals]![SumOfLY_Gross_Revenue],0)=0,0,([Totals]![SumOfCY_Gross_Revenue]-[Totals]![SumOfLY_Gross_Revenue])/[Totals]![SumOfLY_Gross_Revenue])

If SumOfLY_Gross_Revenue is Null or zero, return zero, otherwise return your
original calculation.

HTH,
 
Back
Top