Divisible by zero error

I want the percent used section of the data to have this ----- instead of #Div/0 and or #Num if dividing by zero and below is the formula I am using.


%Used: Format(Nz([YTD],0)/Nz([AnnualBudget],0),"Percent")

Data

Budget      MTD      YTD      %Used

0.00      0.00      441,000.00      #Div/0!

0.00      0.00      0.00      #Num!

1,800.00      21.81      372.67      20.70%
KdankwahAsked:
Who is Participating?
 
Dale FyeConnect With a Mentor Commented:
Since you are using the Format ( ) function, which returns a string, you could simply use:

%Used: IIF(NZ([AnnualBudget],0) = 0, "----", Format(Nz([YTD],0)/[AnnualBudget],"Percent"))
0
 
KdankwahAuthor Commented:
Thanks so much
0
 
KdankwahAuthor Commented:
What will be if I am using a formula that will return a number string.

Thanks
0
 
Dale FyeCommented:
you could still use the iif() function, but cannot embed a string in an otherwise numeric field, so something like:

iif(isnull([field name]), null, [other field]/[field name])
0
 
KdankwahAuthor Commented:
thanks
0
All Courses

From novice to tech pro — start learning today.