Solved

Can I Make a Calculated Field that Returns a Zero if the Calculation Would Result in an Error Due to a Zero in the Denominator?

Posted on 2011-09-09
3
237 Views
Last Modified: 2012-05-12
I am trying to make a ratio of the Total_QNs/Total_Shipped....However, sometimes One or both of those fields is a zero, which returns an error. I would like it to return the ratio if there is data, or a zero if the denominator or numerator is a zero
0
Comment
Question by:Rex85
[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
  • 2
3 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 36513191
iif(Total_QNs = 0 OR Total_Shipped = 0,0,  Total_QNs/Total_Shipped)
0
 

Author Closing Comment

by:Rex85
ID: 36513207
Thank you!
0
 
LVL 61

Expert Comment

by:mbizup
ID: 36513209
Glad to help out :)

In explanation the IIf function evaluates an expression to see if it is tru or false and then returns a value based on that determination.

IIf(someExpression, ReturnThisIfTrue, ReturnThisIfFalse)
0

Featured Post

Independent Software Vendors: 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!

Question has a verified solution.

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

Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

752 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