#Div/0! Error Message in Access

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have the following expression in a report in Access:
=Sum(NZ((IIf([Ind]="Actual-LIHTC",[1],0))+(IIf([Ind]="Actual-HTC",[1],0)))
-(IIf([Ind]="Original Proforma-LIHTC",[1],0)+(IIf([Ind]="Original
Proforma-HTC",[1],0))))
/NZ(IIf([Ind]="Original Proforma-LIHTC",[1],0))

I used Nz hoping to eliminate problems if either divisor or dividend is
zero. Can someone please tell me what I'm missing in this statement?
Thank you for your time.
 
The Nz isn't required in the denominator (NZ(IIf([Ind]="Original
Proforma-LIHTC",[1],0))): that's going to return 0 anytime Ind is Null (same
as whenever Ind isn't "Original Proforma-LIHTC"). You'll definitely get the
Divide by 0 error message in those cases.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"NoviceAccessUser-Melanie"
 
What would be a good way to get around this? If I remove the NZ around the
denominator, I still get the Divide by zero message on the report. The
denominator could be zero in most of the fields in my report.

Douglas J. Steele said:
The Nz isn't required in the denominator (NZ(IIf([Ind]="Original
Proforma-LIHTC",[1],0))): that's going to return 0 anytime Ind is Null (same
as whenever Ind isn't "Original Proforma-LIHTC"). You'll definitely get the
Divide by 0 error message in those cases.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"NoviceAccessUser-Melanie"
I have the following expression in a report in Access:
=Sum(NZ((IIf([Ind]="Actual-LIHTC",[1],0))+(IIf([Ind]="Actual-HTC",[1],0)))
-(IIf([Ind]="Original Proforma-LIHTC",[1],0)+(IIf([Ind]="Original
Proforma-HTC",[1],0))))
/NZ(IIf([Ind]="Original Proforma-LIHTC",[1],0))

I used Nz hoping to eliminate problems if either divisor or dividend is
zero. Can someone please tell me what I'm missing in this statement?
Thank you for your time.
 
iif(expr=0,1,expr)

HTH

Pieter

"NoviceAccessUser-Melanie"
What would be a good way to get around this? If I remove the NZ around the
denominator, I still get the Divide by zero message on the report. The
denominator could be zero in most of the fields in my report.

Douglas J. Steele said:
The Nz isn't required in the denominator (NZ(IIf([Ind]="Original
Proforma-LIHTC",[1],0))): that's going to return 0 anytime Ind is Null
(same
as whenever Ind isn't "Original Proforma-LIHTC"). You'll definitely get
the
Divide by 0 error message in those cases.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"NoviceAccessUser-Melanie"
I have the following expression in a report in Access:
=Sum(NZ((IIf([Ind]="Actual-LIHTC",[1],0))+(IIf([Ind]="Actual-HTC",[1],0)))
-(IIf([Ind]="Original Proforma-LIHTC",[1],0)+(IIf([Ind]="Original
Proforma-HTC",[1],0))))
/NZ(IIf([Ind]="Original Proforma-LIHTC",[1],0))

I used Nz hoping to eliminate problems if either divisor or dividend is
zero. Can someone please tell me what I'm missing in this statement?
Thank you for your time.
 

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

Back
Top