Total weeks

J

Johan Swart

I'm currently busy to design a Storage/Handling charge database. The only
hold up is that I have a query with a column
"Total weeks" -And the result will be calculated from date received less the date dispatched.
I have enter the following to see what would be the outcome
Total weeks:([Receiving Date]-[Dispatch Date])/7, but the result is not correct or what is to should be.

I hope there is genius out there that can assist.
 
J

John Spencer

What is wrong with the result you are getting? Is it showing fractional
weeks and you want whole weeks?

If so, do you want to round up the number to the next largest integer or
round down to the next smallest integer or round up or down to the
nearest integer?

DateDiff("d",[dispatch Date],[Receiving Date]) will return the number of
days between the two dates - not counting the first date. Add 1 if you
want to count that

Dividing that by 7 will return the number of weeks and partial weeks (days)

Int(DateDiff("d",[dispatch Date],[Receiving Date])/7) will chop off the
decimal portion (round Down).

-Int(-DateDiff("d",[dispatch Date],[Receiving Date])/7) will round up

Round(Int(DateDiff("d",[dispatch Date],[Receiving Date])/7),0) will
round up or round down.



'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================


Johan said:
I'm currently busy to design a Storage/Handling charge database. The only
hold up is that I have a query with a column
"Total weeks" -And the result will be calculated from date received less the date dispatched.
I have enter the following to see what would be the outcome
Total weeks:([Receiving Date]-[Dispatch Date])/7, but the result is not correct or what is to should be.

I hope there is genius out there that can assist.
 

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