Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default How to start week numbering (WEEKNUM) on a certain day?


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)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=120542

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,240
Default How to start week numbering (WEEKNUM) on a certain day?

Simon Lloyd wrote:
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)
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default How to start week numbering (WEEKNUM) on a certain day?


Glenn worked perfect thanks!!!Glenn;434348 Wrote:
Simon Lloyd wrote:
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)



--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=120542

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,240
Default How to start week numbering (WEEKNUM) on a certain day?

Glenn;434348 Wrote:
Simon Lloyd wrote:
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)



Simon Lloyd wrote:
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)
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
WEEKNUM change start of week to a monday The Rook[_2_] Excel Discussion (Misc queries) 1 September 3rd 08 09:15 PM
WEEKNUM calculations for week stating with Tuesday P C Verma Excel Worksheet Functions 7 June 12th 08 07:07 AM
WEEKNUM to start on another day Mungie Excel Worksheet Functions 1 August 12th 06 12:35 PM
start/end dates of a week given just the weeknum() value David Excel Discussion (Misc queries) 4 December 12th 05 03:29 PM
weeknum function says jan1=week1, mod to first 4 day week needed sam Excel Discussion (Misc queries) 3 June 13th 05 04:05 PM


All times are GMT +1. The time now is 08:46 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"