Calculating weeks

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to convert elapsed days into elapsed weeks, with any fraction of
a week, rounding up to the next highest week. In Excel, I use the MOD()
function to detemine if Days/Weeks is even or not, and if not, I add one to
the result. I don't see an equivalent function in Access. Am I missing
something?
 
I am trying to convert elapsed days into elapsed weeks, with any fraction of
a week, rounding up to the next highest week. In Excel, I use the MOD()
function to detemine if Days/Weeks is even or not, and if not, I add one to
the result. I don't see an equivalent function in Access. Am I missing
something?

Yup! Your missing the Mod operator (not function).

ElapsedWeeks = IIf([ElapsedDays] Mod 7
=0,int([ElapsedDays]/7),int([ElapsedDays]/7) +1)
 
CGSoniat said:
I am trying to convert elapsed days into elapsed weeks, with any fraction of
a week, rounding up to the next highest week. In Excel, I use the MOD()
function to detemine if Days/Weeks is even or not, and if not, I add one to
the result. I don't see an equivalent function in Access. Am I missing
something?


In VBA Mod is an operator, not a function.

weeks = days \ 7 + IIf((days Mod 7) > 0, 1, 0)
 
Back
Top