Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
soren
 
Posts: n/a
Default first week of year - according to european standard

I am working with week numbers and need Excel to accept as week 1 the first
week of the year with 4 or more days. I.e. week starting Monday 3rd January
2005 should be reflected as week 1.

The program reflects this week as week 2 by default. How to change this?
  #2   Report Post  
Arvi Laanemets
 
Posts: n/a
Default

Hi

I use this formula (with date in cell G2, and NB! I left delimiters as I use
them - when they aren't passing, then edit the formula):

=IF(INT((G2 -
DATE(YEAR(G2);1;1)+1+7-WEEKDAY(G2;2)+4)/7)=0;INT(((DATE(YEAR(G2)-1;12;31)-DA
TE(YEAR(G2)-1;1;1)+1)+7-WEEKDAY(DATE(YEAR(G2)-1;12;31);2)+4)/7);IF(AND(INT((
G2-DATE(YEAR(G2);1;1)+1+7-WEEKDAY(G2;2)+4)/7)=53;WEEKDAY(DATE(YEAR(G2);12;31
);2)<4);1;INT((G2-DATE(YEAR(G2);1;1) +1+7-WEEKDAY(G2;2)+4)/7)))


Arvi Laanemets


"soren" wrote in message
...
I am working with week numbers and need Excel to accept as week 1 the

first
week of the year with 4 or more days. I.e. week starting Monday 3rd

January
2005 should be reflected as week 1.

The program reflects this week as week 2 by default. How to change this?



  #3   Report Post  
Ron Rosenfeld
 
Posts: n/a
Default

On Tue, 2 Nov 2004 09:05:01 -0800, "soren"
wrote:

I am working with week numbers and need Excel to accept as week 1 the first
week of the year with 4 or more days. I.e. week starting Monday 3rd January
2005 should be reflected as week 1.

The program reflects this week as week 2 by default. How to change this?


Here is a UDF that will compute the weeknumber:

=================
Function ISOWeeknum(dt As Date) As Integer
ISOWeeknum = DatePart("ww", dt, vbMonday, vbFirstFourDays)
If ISOWeeknum 52 Then
If DatePart("ww", dt + 7, vbMonday, vbFirstFourDays) = 2 Then
ISOWeeknum = 1
End If
End If
End Function
========================

To enter this, <alt-F11 opens the Visual Basic Editor.
Ensure your project is highlighted in the Project Explorer window, then
Insert/Module and paste the above code into the window that opens.

To use it, in some cell enter =ISOWeeknum(cell_ref) where cell_ref contains a
date.


--ron
  #4   Report Post  
Harald Staff
 
Posts: n/a
Default

Hi Soren

See also
http://www.erlandsendata.no/english/...dateweeknumber
and
http://www.cpearson.com/excel/weeknum.htm

If you want to play with this yourself, one good approach is that January
4th is always in week 1.

HTH. Best wishes Harald

"soren" skrev i melding
...
I am working with week numbers and need Excel to accept as week 1 the

first
week of the year with 4 or more days. I.e. week starting Monday 3rd

January
2005 should be reflected as week 1.

The program reflects this week as week 2 by default. How to change this?



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
Line or bar graphs for tracking stocks profit and loss. Mocity Charts and Charting in Excel 1 January 21st 05 01:21 AM
I need week number in excell from a date, first week must be mini. jPeich Excel Discussion (Misc queries) 4 January 5th 05 01:21 AM
Format an excel column as a date for a 5 day week for a year. dabenesch Excel Discussion (Misc queries) 1 December 30th 04 02:45 PM
Weeknum Year by Year Compare RJB Charts and Charting in Excel 4 December 29th 04 10:33 PM
How do I annualize a standard deviation NIKU Excel Discussion (Misc queries) 3 December 13th 04 12:06 PM


All times are GMT +1. The time now is 10:40 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"