I've a series of dates i want grouped 2 use for averaging totals

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

Guest

I have a series of dates, which i want to group themselves into say weeks, so
i can use the weeks to calculate weekly averages.

I've been cirlcling round trying to find this function,
Either I'm having a blind moment or I need your help...eitherway i need your
help..

Cheers
 
Moo said:
I have a series of dates, which i want to group themselves into say weeks, so
i can use the weeks to calculate weekly averages.

I've been cirlcling round trying to find this function,
Either I'm having a blind moment or I need your help...eitherway i need your
help..


Grouping by month,quarter or year is simple, just group on
an expression like:
Format(datefield, "yyyymm")
Format(datefield, "yyyyq")
DatePart("yyyy",datefield)

But, weeks are a tricky think because you need to know what
day a week starts on and you might even need to know when
the first week in a year starts. If you have that in mind,
then you could use:
Format(datefield,"yyyyww", firstdayofweek, firstweekofyear)
check VBA Help for details.
 
AND it gets even trickier if you are looking at individual dates in the week
and the week is split between years. Depending on your settings the first
few days of the week could fall in one year as the last week of the year and
the last days of the week could fall in the following year as week 1.

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 

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

Back
Top