Find the Date or Date Range from Week Number in Google Sheets

How can you derive a date or date range from a week number in Google Sheets? Here’s how you can reverse-engineer the WEEKNUM function to accomplish this.

The WEEKNUM function helps determine the week number for a given date. However, there’s no built-in function to calculate the date or date range from a week number. By “date range,” I mean the period from the start date to the end date of a specific week.

But don’t worry—I’ve got custom formulas for this! All you need is to provide a year and a week number in two cells.

These formulas will convert the given week number into either a single date (start or end of the week) or an entire week’s range of dates.

Example Setup

Take a look at the setup:

Examples of Finding the Date or Date Range from a Week Number in Google Sheets
  • Year is in cell A2.
  • Week number is in cell B2.

I’ve created formulas for the following:

  • Start date of the week in cell D2.
  • End date of the week in cell E2.

For example:

The 7th week of 2018 begins on 11/02/2018 (Sunday) and ends on 17/02/2018 (Saturday).

Additionally, in cell G2, I have a formula that auto-populates all dates within the specified week number. You’ll find these formulas and their usage tips below.

Find the Date from Week Number

Here’s the formula in cell D2 to find the start date of the given week number:

Formula 1: Start Date

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

Formula 2: End Date

To find the end date of the week (cell E2), use:

=MIN(
   DATE(A2, 12, 31), 
   DATE(A2, 1, 1)-(WEEKDAY(DATE(A2, 1, 1))-1)+(B2-1)*7+6
)

Applying Date Formatting

Both formulas return date values. To display them correctly, select the result cell and go to Format > Number > Date.

Formula Explanation

Start Date

  1. Year Start Date: =DATE(A2, 1, 1) This formula gives the first day of the year, e.g., 01/01/2018.
  2. Weekday Offset: WEEKDAY(DATE(A2, 1, 1))-1 This calculates the weekday number of the year start date. Subtracting 1 adjusts the offset so the week starts on Sunday.
  3. Adjust for Week Number: (B2-1)*7 Subtracting 1 from the week number and multiplying by 7 determines how many days to add to the start of the year to get to the desired week.
  4. Combine: DATE(A2, 1, 1)-(WEEKDAY(DATE(A2, 1, 1))-1)+(B2-1)*7
    The full formula calculates the start date by combining the adjustments.
  5. MAX Function: MAX(DATE(A2, 1, 1), …)
    The MAX function ensures the returned date is not earlier than the year’s start date. This is especially important for week number 1, which might not contain a full Sunday-to-Saturday week.

End Date

To get the end date, simply add 6 days to the start date. However, to ensure the date stays within the same year, we use the MIN function to cap it at 31/12.

Find the Date Range from Week Number

To generate the full week’s dates, use the SEQUENCE function in cell G2.

Formula:

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

Formula Explanation:

  • 7: Generates 7 rows for 7 days.
  • 1: Specifies one column.
  • MAX(...): The start date serves as the first value in the sequence.

Resources for Further Reading

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

Highlight Upcoming Birthdays in Google Sheets

When highlighting upcoming birthdays in Google Sheets, one important aspect is ignoring the year...

Compare Two Tables for Differences in Excel

To compare two tables with similar data for differences, you can use the XLOOKUP...

Calculate Weighted Average in Pivot Table in Google Sheets

You can calculate a weighted average in a Pivot Table using a custom formula...

Summarize Data and Keep the Last Record in Google Sheets

In Google Sheets, we can summarize data (like sum, average, min, max, count) using...

More like this

Highlight Upcoming Birthdays in Google Sheets

When highlighting upcoming birthdays in Google Sheets, one important aspect is ignoring the year...

Calculate Weighted Average in Pivot Table in Google Sheets

You can calculate a weighted average in a Pivot Table using a custom formula...

Summarize Data and Keep the Last Record in Google Sheets

In Google Sheets, we can summarize data (like sum, average, min, max, count) using...

6 COMMENTS

  1. Has anyone told you lately that you’re amazing? Seriously Prashanth, you are so helpful, and I’m grateful you are willing to share your knowledge and that you take the time to explain things so well. Thank you!

  2. I failed to add to my last post, I would like to do this using an ArrayFormula, here is my attempt to make it array, of course, it’s not using the ISOWEEKNUM solution

    ={"Pay Start Date";ARRAYFORMULA(if(B2:B="","",DATE(C2,1,1)-(WEEKDAY(DATE(C2,1,1))-1)+(D2-1)*7))}

    How to make it expandable (arrayformula)?

  3. Very useful and well explained, thank you.

    How to apply to ISOWEEKNUM?

    I need a pay period range using ISOWEEKNUM.

    The start day of the week is a Monday and the end day is a Sunday.

    I am working on a payroll calculation and will concatenate the dates to produce a ‘Pay Period’ column.

    Thank you in advance.

    • Hi, Cisco Muratalla,

      In ISOWEEKNUM, week 1 of the year is the week containing the first Thursday of the year.

      We have no provision to specify the same in the WEEKDAY function.

      So my WEEKDAY based formula that returns date from the week number, may not return the result that you want.

      I don’t have an array formula. But I do have a non-array formula for your purpose.

      I’ll post it soon!

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.