QRY Formula - 'Division by Zero' Error

  • Thread starter Thread starter Guest
  • Start date Start date
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...
 
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)
 
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)
 
Back
Top