From week number to date excel

Is there a way to get the week number from a given date or extract the date range from a specific week number and year in Excel? To solve this task, the following formulas may do you a favor.

Convert week number to date with formulas

Convert date to week number with formulas


Convert week number to date with formulas

Supposing I have a random year and week number which are 2015 and 15 in a worksheet as following screenshot shown, and now I want to find out the specific dates from Monday to Sunday by this given week number.

To calculate the date range by the specific week number, you can use the following formulas:

1. Select a blank cell you will return the start date (in our case we select the Cell B5), enter the formula: =MAX(DATE(B1,1,1),DATE(B1,1,1)-WEEKDAY(DATE(B1,1,1),2)+(B2-1)*7+1), and press the Enter key. See screenshot below:

2. Select another blank cell you will return the end date (in our case we select the Cell B6), enter =MIN(DATE(B1+1,1,0),DATE(B1,1,1)-WEEKDAY(DATE(B1,1,1),2)+B2*7), and press the Enter key. See screenshot below:

note ribbon Formula is too complicated to remember? Save the formula as an Auto Text entry for reusing with only one click in future!
Read more…     Free trial

Note: In both formulas above, B1 contains a year and B2 is a specified week number, you can change the arguments to your need).

3. As you see, both formulas return numbers instead of dates. Keep selecting both calculating results, and click Home > Number Format box > Short Date to change the numbers to dates. See screenshot below:

One click to convert multiple non-standard formatting dates/numbers/text to normal dates in Excel

Kutools for Excel’s Convert to Date utility can help you easily identify and convert non-standard dates or numbers (yyyymmdd) or text to normal dates with only one click in Excel.

ad convert to date 1

Convert date to week number with formulas

On the other hand, you can also apply the WEEKNUM function to convert a date to corresponding week number.

1. Select a blank cell you will return the week number, enter this formula: =WEEKNUM(B1,1), and press the Enter key. See screenshot:

Notes:

(1) In above formula, B1 contains the date that you want to use.

(2) If you need to return the week number from a date which begins in Monday, please apply this formula: =WEEKNUM(B1,2).


Related articles:

How to count the number of specific weekdays between two dates in Excel?

How to add / subtract days / months / years to date in Excel?


The Best Office Productivity Tools

Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%

  • Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails…
  • Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range
  • Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns… Prevent Duplicate Cells; Compare Ranges
  • Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select…
  • Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more…
  • Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments
  • Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic…
  • Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF
  • More than 300 powerful features. Supports Office / Excel 2007-2021 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial. 60-day money back guarantee.

kte tab 201905


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!

officetab bottom

Comments (23)


No ratings yet. Be the first to rate!

If you are looking for the opposite to get a date from a weeknumber i found a solution online and changed it slightly:

Function fnDateFromWeek(iYear As Integer, iWeek As Integer, iWeekDday As Integer)
  ' get the date from a certain day in a certain week in a certain year
  fnDateFromWeek = DateSerial(iYear, 1, (iWeek * 7) _
          + iWeekDday - Weekday(DateSerial(iYear, 1, 1)) + 1)
End Function

I took the formular from asap-utilities.com/ and changed

DateSerial(iYear, 1, ((iWeek - 1) * 7) 

to

DateSerial(iYear, 1, (iWeek * 7)

Update

It seems that at least for germany the formular works not as expected for the leap year 2016 so i changed it to this

Function fnDateFromWeek(iYear As Integer, iWeek As Integer, iWeekDday As Integer)
' get the date from a certain day in a certain week in a certain year
  
    If isLeapYear(iYear) Then
        curDate = DateSerial(iYear, 1, ((iWeek) * 7) _
          + iWeekDday - Weekday(DateSerial(iYear, 1, 1)) + 1)
    Else
        curDate = DateSerial(iYear, 1, ((iWeek - 1) * 7) _
          + iWeekDday - Weekday(DateSerial(iYear, 1, 1)) + 1)
    End If
    fnDateFromWeek = curDate
End Function

Since 2016 hardcoded is not ideal you could check if a year is a leap year with this function

Function isLeapYear(iYear As Integer) As Boolean

    If (Month(DateSerial(iYear, 2, 29)) = 2) Then
        isLeapYear = True
    Else
        isLeapYear = False
    End If
    
End Function

For a non-leap-year DateSerial(iYear,2 ,29) returns 1st of march

This may still be wrong but my limited test gave the expected results:

Sub TestExample()
   Debug.Print Format(fnDateFromWeek(2014, 48, 2), "ddd dd mmm yyyy") ' mo 24 Nov 2014
   Debug.Print Format(fnDateFromWeek(2015, 11, 6), "ddd dd-mmm-yyyy") ' fr 13 Mar 2015
   Debug.Print Format(fnDateFromWeek(2016, 36, 2), "ddd dd-mmm-yyyy") ' Mo 05 Sep 2015
End Sub


You can use the following basic syntax to get the date from a week number in Excel:

=DATE(B2,1,1)+(A2-1)*7-(WEEKDAY(DATE(B2,1,1)))+1

This particular formula makes the following assumptions:

  • Cell A2 contains the week number
  • Cell B2 contains the year
  • The first day of the week is considered to be Sunday

This formula will return the date of the Sunday for a particular week.

If you’d instead like to return the Monday, replace the 1 at the end of the formula with 2.

If you’d instead like to return the Tuesday, replace the 1 at the end of the formula with 3.

And so on.

The following example shows how to use this formula in practice.

Suppose we would like to get the date of the Sunday for week 14 in the year 2023.

We can type the following formula into cell C2 in Excel to calculate this date:

=DATE(B2,1,1)+(A2-1)*7-(WEEKDAY(DATE(B2,1,1)))+1

The following screenshot shows how to use this formula in practice:

Excel get date from week number

The start day of week 14 in 2023 is 4/2/2023.

Note: If the formula returns a number instead, make sure to change the cell format to Date.

If you would instead like to assume that the week starts on a Monday, you can use the following formula to get the date from the week number:

=DATE(B2,1,1)+(A2-1)*7-(WEEKDAY(DATE(B2,1,1)))+2

The following screenshot shows how to use this formula in practice:

The start day of week 14 in 2023 (assuming that weeks start on a Monday) is 4/3/2023.

Additional Resources

The following tutorials explain how to perform other common tasks in Excel:

Excel: How to Convert Date to Day of Week
Excel: How to Add & Subtract Weeks from Dates
Excel: Calculate the Number of Weeks Between Dates

This article will explain how to calculate a date from any week number.

ISO Week Number

Before showing you the formulas, it is important to keep in mind that there are 2 ways to count weekly numbers

  • The North American method (the formulas WEEKNUM in Excel)
  • The international method (the formula ISOWEEKNUM)

In Europe, the calculation of week numbers is governed by the ISO 8601 standard. This standard considers that the first week of the year must have at least 4 days. When the first week of the year begins on a Friday, Saturday or Sunday, these days are not considered the first week of the year.

But for North America, this rule does not exist. The calculation of week numbers starts on January 1st, even if January 1st is a Sunday.

With Excel, this difference can be displayed as follows:

  • With the WEEKNUM function, regardless of the first day of the year, the function always returns the value 1.
  • With ISOWEEKNUM, if the first day of the year is a Friday, Saturday or Sunday, the function considers that the date of January 1 belongs to the week of the previous year.

This notion is important in the result we are going to achieve

Week number of the first day of the year

Common formula to return a date according the week number

The common formula to return on the first day of a week (the week begins on a Monday) is as follows:

=DATE(Year,1,1)+(Week-1)*7-WEEKNUM(DATE(Year,1,1),2)+1

If the week starts on a Sunday, simply remove the +1 at the end

=DATE(Year,1,1)+(Week-1)*7-WEEKNUM(DATE(Year,1,1),2)

Mistake made with the formula 

But this formula does not take into account the problem of ISO week numbers. This function works for the United States and Canada, but not for other countries 

To find out, the following table shows the problem

  • The value of the years in column A
  • The day of the first of January in column B; =DATE(A2,1,1)
  • The result of the calculation of the date from the first week
  • The ISO week number

Comparison week number and first monday

In the previous table, we see that the date calculated for the first week is often in December. In fact, the formula returns the month of January only if January 1 is a Monday

Now, if we consider the year 2021, we can see that 01/01/2021 is a Friday. And so, the calculated Monday will be 28/12/2020. But in this case, we are no longer in week 1 (ISO week number)

Hence a one-week delay compared to calculation standards in Europe 

Therefore, the previous formula must be adapted to handle the ISO week number rule.

Formula that takes into account the ISO week rule

Taking into account the previous remarks, the formula that allows calculating a date from the week number respecting the iso week rule is as follows:

=DATE(Year,1,1)+IF(WEEKDAY(DATE(Year,1,1),2)<5,(WeekNum-1)*7,WeekNum*7)-WEEKDAY(DATE(Year,1,1),2)+1

New formula to calculate date according week number

As you can see, the calculation of the first Monday of the first week of the year is now correct 😃👍

So now, you can replace the week number by any values between 1 and 52 and the result will be correct for the ISO week number system.

Monday of the week 10

This post will guide you how to convert a week number to a date with a formula in Excel. How do I calculate a date from a week number and a year with formula in Excel. Or how to get week number from a given date with formula in Excel.

Table of Contents

  • Convert Week Number to Date
  • Get Week Number From a Date
    • Related Functions

Convert Week Number to Date


Assuming that you have a week number and a year number in your worksheet, and you want to get the start date and end date in that give week in that year. How to achieve it.

You need to create a formula based on the MAX function, the DATE function and the WEEKDAY function to convert week number to a date in Excel. Just do the following steps:

#1 Type the year number in Cell C1, and type the week number in Cell C2.

#2 Type this formula into the formula box of the Cell C3, then press Enter key in your keyboard. The Serial number of the start date is calculated in Cell C3.

=MAX(DATE(C1,1,1),DATE(C1,1,1)-WEEKDAY(DATE(C1,1,1),2)+(C2-1)*7+1)

convert week to date1

#3 Type the following formula into the formula box of the Cell C4, and then press Enter key in your keyboard. And the serial number of the end date is calculated in Cell C4.

=MIN(DATE(C1+1,1,0),DATE(C1,1,1)-WEEKDAY(DATE(C1,1,1),2)+C2*7)

convert week to date2

#4 select the cells C3:C4 and then go to HOME tab, click Number format list box, and select Short Date item. The serial number are changed to a standard date format.  Or you can also select Long Date format from the drop-down list of the Number format.

convert week to date3

Get Week Number From a Date


If you want to get the week number from a given date, then you can use the WEEKNUM function to quickly achieve it. Just type the formula into the Cell D3:

=WEEKNUM(C3,1)

convert week to date4


  • Excel MIN function
    The Excel MIN function returns the smallest numeric value from the numbers that you provided. Or returns the smallest value in the array.The MIN function is a build-in function in Microsoft Excel and it is categorized as a Statistical Function.The syntax of the MIN function is as below:= MIN(num1,[num2,…numn])….
  • Excel MAX function
    The Excel MAX function returns the largest numeric value from the numbers that you provided. Or returns the largest value in the array.= MAX(num1,[num2,…numn])…
  • Excel DATE function
    The Excel DATE function returns the serial number for a date.The syntax of the DATE function is as below:= DATE (year, month, day)…
  • Excel WEEKDAY function
    The Excel WEEKDAY function returns a integer value representing the day fo the week for a given Excel date and the value is range from 1 to 7.The syntax of the WEEKDAY function is as below:=WEEKDAY (serial_number,[return_type])…
  • Excel WEEKNUM function
    The Excel WEEKNUM function returns the week number of a specific date, and the returned value is ranging from 1 to 53.The syntax of the WEEKNUM function is as below:=WEEKNUM (serial_number,[return_type])…

Понравилась статья? Поделить с друзьями:
  • From website to excel
  • From vsd to word
  • From voice to word
  • From uppercase to lowercase in word
  • From unix time excel