Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Week number when year changes

I have a problem with the function weeknum, because the
last days in the year will be 53 and the days in the next
year will have week 1, even though they are in the same
week. I would like to do a custom function in VBA that
handles this in a correct way. Ie I would like the last
days to be 53 only when it actual is 53 weeks in a year,
otherwise I want the last days in a year to be in week 1.
I have tried to program it, but I am really struggling.
Anyone have any idea?

Thanks,

Peter
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Week number when year changes

When do you consider there to be 53 weeks in a year. To get a full 53 weeks
is 371 days, so one would borrow 6 (or five in a leap year) from the
previous year. So the first day of the year would need to be on Sunday or
Satuday depending on when you consider a week to start (Monday or Sunday).
The first and last day of a 365 day year are on the same day.

Anyway, you would need to add some definitions/criteria on what defines a
week and how that translates to a full 53 week year.

--
Regards,
Tom Ogilvy

"Peter" wrote in message
...
I have a problem with the function weeknum, because the
last days in the year will be 53 and the days in the next
year will have week 1, even though they are in the same
week. I would like to do a custom function in VBA that
handles this in a correct way. Ie I would like the last
days to be 53 only when it actual is 53 weeks in a year,
otherwise I want the last days in a year to be in week 1.
I have tried to program it, but I am really struggling.
Anyone have any idea?

Thanks,

Peter



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Week number when year changes

This page might be a help:
http://www.bygsoftware.com/examples/iso_dates.htm
It calculates the week number based on ISO 8601.

It includes the Excel formula and an online week-number calculator using
Microsoft's spreadsheet component.

--

Regards
Andy Wiggins
www.BygSoftware.com
Home of "The Excel Auditor" and "Byg Tools for VBA"



"Peter" wrote in message
...
I have a problem with the function weeknum, because the
last days in the year will be 53 and the days in the next
year will have week 1, even though they are in the same
week. I would like to do a custom function in VBA that
handles this in a correct way. Ie I would like the last
days to be 53 only when it actual is 53 weeks in a year,
otherwise I want the last days in a year to be in week 1.
I have tried to program it, but I am really struggling.
Anyone have any idea?

Thanks,

Peter



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
Current year and current week number Grey Old Man[_2_] Excel Discussion (Misc queries) 11 December 8th 09 06:30 PM
Week Number - Fiscal Year Sarah Excel Worksheet Functions 1 August 18th 09 12:37 AM
Auto calculate day of week to week of the year (not as serial) oftenconfused Excel Discussion (Misc queries) 4 June 23rd 08 05:14 PM
How do I crate a function for week of year + year in same cell. patty ann Excel Worksheet Functions 1 March 16th 08 06:34 PM
Finding the date using the number of the week in a year Bhupinder Rayat Excel Worksheet Functions 2 March 30th 07 11:20 AM


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