dividing zero by zero in a query, getting #error

T

Tina S

I wrote an expression to divide column 1 by column 2 to give me a monthly
result. and I am showing all 12 months, so column 2 is zero, until the end of
the months when the results are filled in. This is giving me a #error.

How can I make it return zero?

Hopefully I have given you enough info to answer my question. Thanks.
 
D

david

You need to replace each of the values with an expression,
like this:

column3: IIF(column2=0,0,column1/column2)

(david)
 
T

Tina S

I got it to work by doing this,

Field: Column3: IIf([Column2]<>0,([Column1]/[Column2]),0)
Made the Total: Expression.

Now the report footer that is summing these results is returning
"#Div/0!" and "#Num!". Now as the months go by, the data will fill in and
it should return the proper sums, but can this be fixed so the report looks
better?
 
D

david

What expression do you have in the report control that is returning
#div/0 ? You may wish to use an IIF expression there.

Also, you may like the result better using Null instead of zero.
Field: Column3: IIf([Column2]<>0,([Column1]/[Column2]),Null)

(david)

Tina S said:
I got it to work by doing this,

Field: Column3: IIf([Column2]<>0,([Column1]/[Column2]),0)
Made the Total: Expression.

Now the report footer that is summing these results is returning
"#Div/0!" and "#Num!". Now as the months go by, the data will fill in and
it should return the proper sums, but can this be fixed so the report
looks
better?

david said:
You need to replace each of the values with an expression,
like this:

column3: IIF(column2=0,0,column1/column2)

(david)
 
T

Tina S

I do 3 things. the first 2 are not visible on the reoprt.

The first textbox is "=Sum([Column1])"
The second textbox is "=Sum([Column2)]
The third textbox that is visible and is returning "#Div/0!" and "#Num!" is
"=([SUMColumn1]/[SUMColumn2])"

david said:
What expression do you have in the report control that is returning
#div/0 ? You may wish to use an IIF expression there.

Also, you may like the result better using Null instead of zero.
Field: Column3: IIf([Column2]<>0,([Column1]/[Column2]),Null)

(david)

Tina S said:
I got it to work by doing this,

Field: Column3: IIf([Column2]<>0,([Column1]/[Column2]),0)
Made the Total: Expression.

Now the report footer that is summing these results is returning
"#Div/0!" and "#Num!". Now as the months go by, the data will fill in and
it should return the proper sums, but can this be fixed so the report
looks
better?

david said:
You need to replace each of the values with an expression,
like this:

column3: IIF(column2=0,0,column1/column2)

(david)


I wrote an expression to divide column 1 by column 2 to give me a
monthly
result. and I am showing all 12 months, so column 2 is zero, until the
end
of
the months when the results are filled in. This is giving me a #error.

How can I make it return zero?

Hopefully I have given you enough info to answer my question. Thanks.
 
T

Tina S

I GOT IT TO WORK BY DOING,

=IIf([Name of Sum of Column2]<>0,([Name of Sum of Column1]/[Name of Sum of
Column2]),0



Tina S said:
I do 3 things. the first 2 are not visible on the reoprt.

The first textbox is "=Sum([Column1])"
The second textbox is "=Sum([Column2)]
The third textbox that is visible and is returning "#Div/0!" and "#Num!" is
"=([SUMColumn1]/[SUMColumn2])"

david said:
What expression do you have in the report control that is returning
#div/0 ? You may wish to use an IIF expression there.

Also, you may like the result better using Null instead of zero.
Field: Column3: IIf([Column2]<>0,([Column1]/[Column2]),Null)

(david)

Tina S said:
I got it to work by doing this,

Field: Column3: IIf([Column2]<>0,([Column1]/[Column2]),0)
Made the Total: Expression.

Now the report footer that is summing these results is returning
"#Div/0!" and "#Num!". Now as the months go by, the data will fill in and
it should return the proper sums, but can this be fixed so the report
looks
better?

:

You need to replace each of the values with an expression,
like this:

column3: IIF(column2=0,0,column1/column2)

(david)


I wrote an expression to divide column 1 by column 2 to give me a
monthly
result. and I am showing all 12 months, so column 2 is zero, until the
end
of
the months when the results are filled in. This is giving me a #error.

How can I make it return zero?

Hopefully I have given you enough info to answer my question. Thanks.
 
D

david

:~) Glad it's working
(david)

Tina S said:
I GOT IT TO WORK BY DOING,

=IIf([Name of Sum of Column2]<>0,([Name of Sum of Column1]/[Name of Sum of
Column2]),0



Tina S said:
I do 3 things. the first 2 are not visible on the reoprt.

The first textbox is "=Sum([Column1])"
The second textbox is "=Sum([Column2)]
The third textbox that is visible and is returning "#Div/0!" and "#Num!"
is
"=([SUMColumn1]/[SUMColumn2])"

david said:
What expression do you have in the report control that is returning
#div/0 ? You may wish to use an IIF expression there.

Also, you may like the result better using Null instead of zero.

Field: Column3: IIf([Column2]<>0,([Column1]/[Column2]),Null)

(david)

I got it to work by doing this,

Field: Column3: IIf([Column2]<>0,([Column1]/[Column2]),0)
Made the Total: Expression.

Now the report footer that is summing these results is returning
"#Div/0!" and "#Num!". Now as the months go by, the data will fill
in and
it should return the proper sums, but can this be fixed so the report
looks
better?

:

You need to replace each of the values with an expression,
like this:

column3: IIF(column2=0,0,column1/column2)

(david)


I wrote an expression to divide column 1 by column 2 to give me a
monthly
result. and I am showing all 12 months, so column 2 is zero, until
the
end
of
the months when the results are filled in. This is giving me a
#error.

How can I make it return zero?

Hopefully I have given you enough info to answer my question.
Thanks.
 
T

Tina S

Thanks for your time and help! :)

david said:
:~) Glad it's working
(david)

Tina S said:
I GOT IT TO WORK BY DOING,

=IIf([Name of Sum of Column2]<>0,([Name of Sum of Column1]/[Name of Sum of
Column2]),0



Tina S said:
I do 3 things. the first 2 are not visible on the reoprt.

The first textbox is "=Sum([Column1])"
The second textbox is "=Sum([Column2)]
The third textbox that is visible and is returning "#Div/0!" and "#Num!"
is
"=([SUMColumn1]/[SUMColumn2])"

:

What expression do you have in the report control that is returning
#div/0 ? You may wish to use an IIF expression there.

Also, you may like the result better using Null instead of zero.

Field: Column3: IIf([Column2]<>0,([Column1]/[Column2]),Null)

(david)

I got it to work by doing this,

Field: Column3: IIf([Column2]<>0,([Column1]/[Column2]),0)
Made the Total: Expression.

Now the report footer that is summing these results is returning
"#Div/0!" and "#Num!". Now as the months go by, the data will fill
in and
it should return the proper sums, but can this be fixed so the report
looks
better?

:

You need to replace each of the values with an expression,
like this:

column3: IIF(column2=0,0,column1/column2)

(david)


I wrote an expression to divide column 1 by column 2 to give me a
monthly
result. and I am showing all 12 months, so column 2 is zero, until
the
end
of
the months when the results are filled in. This is giving me a
#error.

How can I make it return zero?

Hopefully I have given you enough info to answer my question.
Thanks.
 

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

Top