# Can't match simple math problem

I have this in an Excel file:

Note that \$3,525.00 - \$494.00 = \$3,031 and that \$3,031 / 5 = \$606.20

But I'm getting this in a query:

See that I'm getting \$3,426.20 as the result and I'm not sure why.

My formula for the value of 5 is...

(Int(DateDiff("d",[End],[Start])/7)*-1)

And the formula for my result is...

[POvalue]-[Distribution]/(Int(DateDiff("d",[End],[Start])/7)*-1)

Why am I not getting \$606.20 as a result?
Microsoft Access

Last Comment
SteveL13
Shaun Kline

THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Shaun Kline

[POvalue] - ([Distribution] / (Int(DateDiff("d",[End],[Start])/7)*-1) )
If you try ([POvalue]-[Distribution])/(Int(DateDiff("d",[End],[Start])/7)*-1) does it work?

(Order of operations)
it_saige

Because of the order of operations:

Your calculation right now looks like:

3525.00 - 494.00 / 5 = 3525.00 - 98.8 = 3426.2

In order to get your expected results, you need to enclose your subtracted portion of the equation in parenthesis; e.g. -
``````([POvalue]-[Distribution])/(Int(DateDiff("d",[End],[Start])/7)*-1)
``````
-saige-
it_saige

Yeah what the others said.  LOL...

-saige-
SteveL13

That was it.  Thank you!
Microsoft Access

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.

226K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts

TRUSTED BY