Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Divisible by zero error

Posted on 2014-03-24
5
Medium Priority
?
313 Views
Last Modified: 2014-03-24
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%
0
Comment
Question by:Kdankwah
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 48

Accepted Solution

by:
Dale Fye earned 2000 total points
ID: 39950357
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
 

Author Comment

by:Kdankwah
ID: 39950370
Thanks so much
0
 

Author Comment

by:Kdankwah
ID: 39950371
What will be if I am using a formula that will return a number string.

Thanks
0
 
LVL 48

Expert Comment

by:Dale Fye
ID: 39950848
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
 

Author Comment

by:Kdankwah
ID: 39950904
thanks
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question