Solved

Help with #Num!  error on a report

Posted on 2001-07-02
8
275 Views
Last Modified: 2012-05-04
When I use a calculated field on a report and it is dividing a number by zero, it produces an error #Num! in the field on the report.
Is there a way to have it produce the answer whenever it is legit, but replace the #Num! with 0 or anything I decide.
I was thinking maybe IIF ?

Thanks

Bill
0
Comment
Question by:bmeehan
[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
  • 5
  • 2
8 Comments
 
LVL 12

Expert Comment

by:Paurths
ID: 6245908
here is an example of that:

field3: IIf([field2]=0;"0";[field1]/[field2])

cheers
Ricky
0
 
LVL 8

Expert Comment

by:dovholuk
ID: 6245930
paurths is on the money (not sure about those semi-colons though?)

i would change it around a bit to accept NULL values as well. such as:

CalculatedField : IIF(Nz(AFieldThatCouldBeZero,0) = 0, 'INF', SomeOtherField / AFieldThatCouldBeZero)

just adding to paurths comment...

dovholuk
0
 

Author Comment

by:bmeehan
ID: 6245959
I tried this:
=IIf([SumOfmay margin]/[SumOfmay amt]=0," ",[SumOfmay margin]/[SumOfmay amt])

and the answer is either the correct amt or I get a #Num!

I notice it is when both margin and amt = 0
Could it have something like division by 0 is not allowed?

Bill
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 12

Accepted Solution

by:
Paurths earned 50 total points
ID: 6245980
=IIf([SumOfmay amt]=0," ",[SumOfmay margin]/[SumOfmay amt])
0
 
LVL 12

Expert Comment

by:Paurths
ID: 6245989
u checked the division in the iif statement to a 0 value.
if sumofmay amt is yet zero then u have #num result, so it is not 0 and the true part of the iif statement is not shown. Only the false.
0
 
LVL 12

Expert Comment

by:Paurths
ID: 6245991
btw, exactly, division by zero can not be processed.
0
 
LVL 12

Expert Comment

by:Paurths
ID: 6246008
or checking for null values also (dovholuk)
=IIf(Nz([sumOfMay amt];0)=0;" ";[SumOfMay margin]/[SumOfMay amt])
0
 

Author Comment

by:bmeehan
ID: 6246153
That's it!

Thanks for the help.

Bill
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
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.

726 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