Avatar of SteveL13
SteveL13Flag for United States of America

asked on 

Can't match simple math problem

I have this in an Excel file:

 User generated image
Note that $3,525.00 - $494.00 = $3,031 and that $3,031 / 5 = $606.20

But I'm getting this in a query:

 User generated image
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

Avatar of undefined
Last Comment
SteveL13
ASKER CERTIFIED SOLUTION
Avatar of Shaun Kline
Shaun Kline
Flag of United States of America image

Blurred text
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.
See Pricing Options
Start Free Trial
Avatar of Shaun Kline
Shaun Kline
Flag of United States of America image

The answer you got was:
[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)
Avatar of it_saige
it_saige
Flag of United States of America image

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)

Open in new window

-saige-
Avatar of it_saige
it_saige
Flag of United States of America image

Yeah what the others said.  LOL...

-saige-
Avatar of SteveL13
SteveL13
Flag of United States of America image

ASKER

That was it.  Thank you!
Microsoft Access
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
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo