Division by zero error

  • Thread starter Thread starter Thrava
  • Start date Start date
T

Thrava

I get a error running this one query that divides two
fields to get the percent market share.

Obviously one, or more of the denominators are zero so I
get this error message.

What is the way around this? I still like to have Access
do this division, but is there a way to have Access add
N/A for these ? or what else do people do to get around
this.

Thanks
Thrava
 
You can use an IIF() statement to check for that.

IIF([YourDenominator] = 0, "N/A",[YourNumerator]/[YourDenominator])
 
Thrava said:
I get a error running this one query that divides two
fields to get the percent market share.

Obviously one, or more of the denominators are zero so I
get this error message.

What is the way around this? I still like to have Access
do this division, but is there a way to have Access add
N/A for these ? or what else do people do to get around
this.


=IIf([SomeField] = 0, "NA", [SomeOtherField]/[SomeField])
 
Thank you very much.
This is exactly what I needed.

-----Original Message-----
You can use an IIF() statement to check for that.

IIF([YourDenominator] = 0, "N/A",[YourNumerator]/ [YourDenominator])

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


I get a error running this one query that divides two
fields to get the percent market share.

Obviously one, or more of the denominators are zero so I
get this error message.

What is the way around this? I still like to have Access
do this division, but is there a way to have Access add
N/A for these ? or what else do people do to get around
this.

Thanks
Thrava


.
 
Thank you very much.
This is exactly what I needed.
-----Original Message-----
Thrava said:
I get a error running this one query that divides two
fields to get the percent market share.

Obviously one, or more of the denominators are zero so I
get this error message.

What is the way around this? I still like to have Access
do this division, but is there a way to have Access add
N/A for these ? or what else do people do to get around
this.


=IIf([SomeField] = 0, "NA", [SomeOtherField]/[SomeField])


--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com


.
 
You are quite welcome.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


Thrava said:
Thank you very much.
This is exactly what I needed.

-----Original Message-----
You can use an IIF() statement to check for that.

IIF([YourDenominator] = 0, "N/A",[YourNumerator]/ [YourDenominator])

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


I get a error running this one query that divides two
fields to get the percent market share.

Obviously one, or more of the denominators are zero so I
get this error message.

What is the way around this? I still like to have Access
do this division, but is there a way to have Access add
N/A for these ? or what else do people do to get around
this.

Thanks
Thrava


.
 
Back
Top