How to start week numbering (WEEKNUM) on a certain day?

S

Simon Lloyd

Hi all,
I have been trying to use WEEKNUM to determine week numbers for my
given dates, however my company starts their weekdays on a Sunday (no
problem as i use =IF($A1="","",WEEKNUM($A1,1)) ), the problem is that a
new week (week 2) starts on Sunday 4th January 2009, my company started
their first week on that Sunday, so its the begining of week 1!

I have tried manipulating this
=1+INT((A1-DATE(YEAR(A1+4-WEEKDAY(A1+6)),1,5)+WEEKDAY(DATE(YEAR(A1+4-WEEKDAY(A1+6)),1,3)))/7)
and can get it to work to a fashion for 09 but moving in to 2010 it
doesn't. I need the formula to work year on year, any ideas?

I will be adding the formulae to cells programatically.


--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
 
G

Glenn

Simon said:
Hi all,
I have been trying to use WEEKNUM to determine week numbers for my
given dates, however my company starts their weekdays on a Sunday (no
problem as i use =IF($A1="","",WEEKNUM($A1,1)) ), the problem is that a
new week (week 2) starts on Sunday 4th January 2009, my company started
their first week on that Sunday, so its the begining of week 1!

I have tried manipulating this
=1+INT((A1-DATE(YEAR(A1+4-WEEKDAY(A1+6)),1,5)+WEEKDAY(DATE(YEAR(A1+4-WEEKDAY(A1+6)),1,3)))/7)
and can get it to work to a fashion for 09 but moving in to 2010 it
doesn't. I need the formula to work year on year, any ideas?

I will be adding the formulae to cells programatically.

Does this work for you?

=WEEKNUM(A1-WEEKDAY(A1)+1)-1+(WEEKDAY(DATE(YEAR(A1-WEEKDAY(A1)+1),1,1))=1)
 
G

Glenn

Simon said:
Glenn worked perfect thanks!!!


You're welcome! By the way, this can be slightly simplified:

=WEEKNUM(A1-WEEKDAY(A1)+1)-(WEEKDAY(DATE(YEAR(A1-WEEKDAY(A1)+1),1,1))<>1)
 

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