By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,826 Members | 2,443 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,826 IT Pros & Developers. It's quick & easy.

Dividing by Zero.......avoid the #Num! from displaying

kcdoell
100+
P: 230
Hello:

I have three unbound text boxes in which I have the following calculations in the control source of each box:

FCST Total; [SumGWP]
Expand|Select|Wrap|Line Numbers
  1. =Nz(DSum("[GWP]","ReQryForecast","[Binding_Percentage] >= 75"),0)
Budget Total; [TxtBudGWP]
Expand|Select|Wrap|Line Numbers
  1. =Nz(DSum("[SumOfGWP]","QryBudget_Sum"),0)
FCST vs. Budget; [FCSTvsPrior_GWP]
Expand|Select|Wrap|Line Numbers
  1. =(Nz(Forms!Forecast!SumGWP,0)-Nz(Forms!Forecast!TxtBudGWP,0))/Nz(Forms!Forecast!TxtBudGWP,0)
My issue is that when [TxtBudGWP] is 0 I get a #Num! In my [FCSTvsPrior_GWP]. I know in one case, [FCSTvsPrior_GWP] would be doing a calculation of (0-0)/0. How can I avoid the #Num! from displaying or how can I compensate for the scenario of a calculation that is dividing by zero?

Thanks,

Keith.
May 5 '08 #1
Share this Question
Share on Google+
2 Replies


kcdoell
100+
P: 230
I solved it!

Expand|Select|Wrap|Line Numbers
  1. =IIf([TxtBudGWP]=0,0,(([Forms]![Forecast]![SumGWP])-([Forms]![Forecast]![TxtBudGWP]))/([Forms]![Forecast]![TxtBudGWP]))
  2.  
Thanks,

Keith
May 5 '08 #2

NeoPa
Expert Mod 15k+
P: 31,489
That's about the size of it Keith :)
May 5 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.