Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default Sort by week and year

Hi,

I am using below dates and convert them to
year and week using a formula that looks like this
=YEAR(A1)&"/"&WEEKNUM(A1)

5/7/2007 0:00 2007/19
1/9/2007 0:00 2007/2
5/15/2007 0:00 2007/20

The combined year and week is then base for a pivot tabel
where I sort the columns by the "Year/week".
The problem is that week 2 is sorted after week 19.

Is there some way to get the "year/week" to look like this
2007/02 when the week is 1-9?

The reason why I can not sort only by week is that I have dates
from different year. Sorting by week then mix up data from
year 2006 week 2 and year 2007 week 2.

Is there some smart person out there who can help me with
this problem:)?

Patric
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,856
Default Sort by week and year

Try this:

=YEAR(A1)&"/"&TEXT(WEEKNUM(A1),"00")

This will give you leading zeros if the week number is less than 10.

Hope this helps.

Pete

On May 31, 10:29 pm, Patric wrote:
Hi,

I am using below dates and convert them to
year and week using a formula that looks like this
=YEAR(A1)&"/"&WEEKNUM(A1)

5/7/2007 0:00 2007/19
1/9/2007 0:00 2007/2
5/15/2007 0:00 2007/20

The combined year and week is then base for a pivot tabel
where I sort the columns by the "Year/week".
The problem is that week 2 is sorted after week 19.

Is there some way to get the "year/week" to look like this
2007/02 when the week is 1-9?

The reason why I can not sort only by week is that I have dates
from different year. Sorting by week then mix up data from
year 2006 week 2 and year 2007 week 2.

Is there some smart person out there who can help me with
this problem:)?

Patric



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default Sort by week and year

Pete....

It sure helped a lot!!!
Thank you so much:)
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,856
Default Sort by week and year

Thanks for feeding back.

Pete

On Jun 1, 12:21 am, Patric wrote:
Pete....

It sure helped a lot!!!
Thank you so much:)



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
Finding the date using the number of the week in a year Bhupinder Rayat Excel Worksheet Functions 2 March 30th 07 11:20 AM
how to insert month date year and day of week Sachi Noma Excel Discussion (Misc queries) 3 May 19th 06 03:03 AM
how to insert month date year and day of week Sachi Noma New Users to Excel 2 May 19th 06 03:03 AM
Week of the Year Ed Excel Discussion (Misc queries) 2 May 12th 06 10:43 PM
first week of year - according to european standard soren Excel Worksheet Functions 3 November 2nd 04 07:21 PM


All times are GMT +1. The time now is 12:49 PM.

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"