If you’ve had to summarize data in Excel, there’s no question you’ve used the “month()” function and the “year()” function, but many of us don’t realize there’s also a “week()” function. Given you have dates within your table of data…

How do you append the week number?
One solution is to calculate the week as every 7 days from the start of the year. This is termed “absolute week number” but doesn’t give you the span from Sunday to Saturday, as many businesses like to measure performance. It starts on the first day of the year, so if this year started on a Tuesday - your weeks are measured starting on Tuesday. Here’s the function to do that:
=TRUNC(((A2-DATE(YEAR(A2),1,0))+6)/7)
And this is what it returns, the number of the 7th day occurrence during that year:

The other solution to this problem is to use a “Add-In” called “Analysis ToolPak”. Under the “Tools” menu, select “Add-Ins…”:

Under the resulting pop-up dialog, check the “Analysis ToolPak” and press “OK”.

Now you can use the function for “WEEKNUM()” that takes two parameters, one is a date (or a reference to a cell with the date) and one is an offset for what day the week should start upon - 1-7 for Sunday to Saturday respectively. Here’s what the function looks like in our spreadsheet:
=WEEKNUM(A2,1)
That function returns the calendar week number of this year with Sunday as the starting day of the week. Here’s a copy of the spreadsheet from before, only with a new column showing the result of this function. You can see on the first row that the numbers are actually different:

Tags: Excel 2003 by James Sullivan
2 Comments »