QRY Formula - 'Division by Zero' Error

G

Guest

I need to divide two fields. For simplicity I'll use Sales $ and Sales Units
as examples.

Sales $ / Sales Units = Average Retail Price

My issue is I receive the 'Division by Zero' error when I use a simple
formula. As I need to include all members including those with zero, I need
to know if there is a formula simular to Excel's 'IF'.

i.e. If <> zero, then perform the calcualtion, if zero, then return '0'.

One I use in Excel - IF(ISERROR(A8/B8),0,(A8/B8))

Thanks in advance for the help...
 
J

John Viescas

IIf(B8 <> 0, A8/B8, 0)

--
John Viescas, author
"Building Microsoft Access Applications" (Coming Soon!)
"Microsoft Office Access 2003 Inside Out"
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals"
http://www.viescas.com/
(Microsoft Access MVP since 1993)
 
B

Brian

TOMB said:
I need to divide two fields. For simplicity I'll use Sales $ and Sales Units
as examples.

Sales $ / Sales Units = Average Retail Price

My issue is I receive the 'Division by Zero' error when I use a simple
formula. As I need to include all members including those with zero, I need
to know if there is a formula simular to Excel's 'IF'.

i.e. If <> zero, then perform the calcualtion, if zero, then return '0'.

One I use in Excel - IF(ISERROR(A8/B8),0,(A8/B8))

Thanks in advance for the help...

Yes, it's called Iif (Immediate if)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Division by Zero Error 1
Division by zero error 16
division by zero-PLEASE HELP 5
Nz/Null in MakeTable Qry 3
Division By Zero error 2
division by zero 5
Division by Zero 1
Division by Zero Error 4

Top