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
235 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
  • 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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SYbase 4 31
Query Syntax 17 36
Binding recordsets to a form 6 27
how to conditionally format (bold) the most current week's records in a subreport 8 48
'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
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.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

803 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