Calculation Value Wrong

G

Guest

I have the following calculation setup as an expression in a query

((([PresentDays]-[C_O_ADJ_DA])/[BID_DA])-1) where PresentDays = 202,
C_O_ADJ_DA = 32 and BID_DA = 200. The result should be -.15 but I'm getting
-.10

Can anyone tell me why? I've tried setting the format to Standard and
General with the decimal place set to 2.

When I replace the varibles with the actual number values it gives the
correct value.
 
D

Dale Fye

Mike,

I'm with John, the math should work. But there could be a problem because
of the conversion of different data types.

Have you tried:

(((cdbl([PresentDays])-cdbl([C_O_ADJ_DA]))/cdbl([BID_DA]))-1)

How about:

cdbl([PresentDays] - [C_O_ADJ_DA] - [BID_DA]) / cdbl([BID_DA]


Dale

Mike Johnson said:
Yes I have. PresentDays is an expression in the query and the other two
are
fields that are being displayed. I've tried making two seperate expression
breaking up the expression into two parts but still get the same results.

John Spencer (MVP) said:
202 - 32 = 170
170/200 = .85
.85 - 1 = -.15

That is the arithmetic you are performing. So you should be getting the
results
you say you expect. Are you sure that the values in the fields are what
you say
they are. Have you for testing purposes included the individual values
as
columns in the query?



Mike said:
I have the following calculation setup as an expression in a query

((([PresentDays]-[C_O_ADJ_DA])/[BID_DA])-1) where PresentDays = 202,
C_O_ADJ_DA = 32 and BID_DA = 200. The result should be -.15 but I'm
getting
-.10

Can anyone tell me why? I've tried setting the format to Standard and
General with the decimal place set to 2.

When I replace the varibles with the actual number values it gives the
correct value.
 

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