Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Convert WEEKNUM(date;2) to text "Monday 25th - Sunday 31st October

Two questions:

1. "Get text string on basis of date":
In cell A1 I have a date with format "dd/mm/yyyy" (for example
"27/10/2004"). Now I want to get in cell B1 a text string telling me the week
that date falls into (for example "Monday 25th - Sunday 31st October").

What function do I have to use in cell B2 to get this text string?

2. "Get text string on basis of weeknumber":
In cell A1 I have the number of a week (WEEKNUM(A1;2)). How can I get in B1
a text string telling me the week that date falls into (for example "Monday
25th - Sunday 31st October") using the value of the weeknumber in A1?

TIA

Martin
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Convert WEEKNUM(date;2) to text "Monday 25th - Sunday 31st Oct

Dear Ron:

Your first answer works great for dates.

Concerning the second question, my boss asks me to give weekly reports,
running from monday to sunday. That´s why I need a function to transfer
weeknumbers into text strings like "Monday 1st - Sunday 7th November".

www.cpearsob.com/excel/weeknum.htm gives an example how to calculate the
weeknumber based on a date.

I want to do the other way around: calculate the week textstring based on a
weeknumber.
Any ideas how to get this function working? (Let´s stick with the
weeknum(date,2) format ok?)

"Ron Rosenfeld" wrote:

On Wed, 27 Oct 2004 06:01:03 -0700, "Martin Los" <Martin
wrote:

Two questions:

1. "Get text string on basis of date":
In cell A1 I have a date with format "dd/mm/yyyy" (for example
"27/10/2004"). Now I want to get in cell B1 a text string telling me the week
that date falls into (for example "Monday 25th - Sunday 31st October").

What function do I have to use in cell B2 to get this text string?


=TEXT(A1+1-WEEKDAY(A1-1),"dddd dd") & " - "
& TEXT(A1+7-WEEKDAY(A1-1),"dddd dd mmmm")

(You will probably want to change my commas (,) into semicolons (;).


2. "Get text string on basis of weeknumber":
In cell A1 I have the number of a week (WEEKNUM(A1;2)). How can I get in B1
a text string telling me the week that date falls into (for example "Monday
25th - Sunday 31st October") using the value of the weeknumber in A1?


Consider if you want to use Excel's WEEKNUM function, or if you want to compute
the ISO Weeknumber which is defined differently.


--ron

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Convert WEEKNUM(date;2) to text "Monday 25th - Sunday 31st Oct

On Thu, 28 Oct 2004 00:05:02 -0700, "Martin Los"
wrote:

Dear Ron:

Your first answer works great for dates.

Concerning the second question, my boss asks me to give weekly reports,
running from monday to sunday. That´s why I need a function to transfer
weeknumbers into text strings like "Monday 1st - Sunday 7th November".

www.cpearsob.com/excel/weeknum.htm gives an example how to calculate the
weeknumber based on a date.

I want to do the other way around: calculate the week textstring based on a
weeknumber.
Any ideas how to get this function working? (Let´s stick with the
weeknum(date,2) format ok?)


The problem with WEEKNUM is that you have to decide what you want to do with
"weeks" that are less than seven days long. Week 1 will start on January 1,
regardless of the day of the week; and Week 2 will start on the next Monday.
Week 53 will end on the last day of the year.

For example, using the formula =WEEKNUM(dt;2), and starting with 27 Dec 2004,
we have week 53 which is five days long, and then we have week 1 of 2005 which
is 2 days long.

A WEEK defined according to the ISO definition will always be seven days long,
and will always start on a Monday.

So you need to check with your boss as to what he wants to do with "weekly"
reports when the last/first week of the year is not a full week.


--ron
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Convert WEEKNUM(date;2) to text "Monday 25th - Sunday 31st Oct

I also need to work out how to do No 2, i. e Covert WEEKNUM(date;2) to text
"Monday 25th - SUnday 31st Oct and defintely by WEEKNUM date and not ISO
definition. Basically I have a pivot table that counts how many patients in
that particular week (ending Sundays) and need to put the dates above of what
what week number is. Can anyone help?




"Ron Rosenfeld" wrote:

On Thu, 28 Oct 2004 00:05:02 -0700, "Martin Los"
wrote:

Dear Ron:

Your first answer works great for dates.

Concerning the second question, my boss asks me to give weekly reports,
running from monday to sunday. That´s why I need a function to transfer
weeknumbers into text strings like "Monday 1st - Sunday 7th November".

www.cpearsob.com/excel/weeknum.htm gives an example how to calculate the
weeknumber based on a date.

I want to do the other way around: calculate the week textstring based on a
weeknumber.
Any ideas how to get this function working? (Let´s stick with the
weeknum(date,2) format ok?)


The problem with WEEKNUM is that you have to decide what you want to do with
"weeks" that are less than seven days long. Week 1 will start on January 1,
regardless of the day of the week; and Week 2 will start on the next Monday.
Week 53 will end on the last day of the year.

For example, using the formula =WEEKNUM(dt;2), and starting with 27 Dec 2004,
we have week 53 which is five days long, and then we have week 1 of 2005 which
is 2 days long.

A WEEK defined according to the ISO definition will always be seven days long,
and will always start on a Monday.

So you need to check with your boss as to what he wants to do with "weekly"
reports when the last/first week of the year is not a full week.


--ron

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
Convert WEEKNUM(date;2) to text "Monday 25th - Sunday 31st Oct" Orcababe Excel Discussion (Misc queries) 3 April 22nd 09 11:52 AM
Formula has to take Monday if due date falls on a Sunday Revathi Excel Worksheet Functions 2 April 28th 06 12:09 PM
Formula to Indicate name of day (Sunday, Monday etc..) based on a Date dannboy213 Excel Discussion (Misc queries) 4 January 31st 06 07:37 PM
Find the date for monday prior to May 25th Ralph Heidecke Excel Worksheet Functions 1 January 5th 06 12:30 AM
adding day (sunday, Monday) to date RickyDee Excel Worksheet Functions 4 September 10th 05 07:14 PM


All times are GMT +1. The time now is 11:19 AM.

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

About Us

"It's about Microsoft Excel"