The WEEKNUM function in Google Sheets provides a way to determine the specific week number in a given year for a particular date. This can be particularly useful for organizing schedules, tracking data by week, or reporting purposes where weekly intervals are significant.
Syntax
WEEKNUM(date, [type])
- date: The date for which you want to find the corresponding week number; this can be a reference to a cell containing a date or a date value in quotes.
- type: (optional) A number that defines the system to use for numbering weeks. The default is 1, which means weeks start on Sunday. If set to 2, the week starts on Monday.
Example #1
WEEKNUM("2023-10-01")
This function returns the week number for October 1, 2023, using the default setting where the week starts on Sunday. For this date, the result will be 40.
Example #2
WEEKNUM("2023-10-01", 2)
This function evaluates the week number for October 1, 2023, based on a week that starts on Monday. In this case, the week number returned will be 39.
Example #3
WEEKNUM(A1)
If cell A1 contains the date “2023-12-25”, this function calculates the week number for December 25, 2023, with the result being 52, as this date falls in the last week of the year.
Error handling
- VALUE!: This error occurs if the date provided is not recognized as a valid date. Ensure the argument is a correctly formatted date.
- NUM!: This error arises if the week type parameter specified is not a permissible value, meaning it should be either 1 or 2. Make sure to use valid types.