Return the next date that matches a weekday number
=IF(
OR(date="", weekday_num=""),
"",
IF(
OR(weekday_num<1, weekday_num>7),
"",
date + MOD(weekday_num - WEEKDAY(date, 2), 7)
)
)NEXT_WEEKDAY returns the next date (including the given date) that falls on the weekday you specify. It's useful for scheduling recurring events like "next Tuesday," aligning timelines to a specific weekday, or generating due dates. For example, if A2 contains "2026-01-11" and B2 contains "3" then =NEXT_WEEKDAY(A2, B2) returns "2026-01-14". If A2 contains "2026-01-12" and B2 contains "1" then =NEXT_WEEKDAY(A2, B2) returns "2026-01-12".
Use the inputs below to create NEXT_WEEKDAY as a reusable custom function in Google Sheets.
Learn how to add custom functions to Google SheetsNEXT_WEEKDAY
Return the next date that matches a weekday number
=IF( OR(date="", weekday_num=""), "", IF( OR(weekday_num<1, weekday_num>7), "", date + MOD(weekday_num - WEEKDAY(date, 2), 7) ) )
date
weekday_num
Start date to evaluate from
A2
Weekday number where 1=Mon … 7=Sun
5
Other functions in the same category: Date & Time Operations
Returns TRUE if a date falls on Monday through Friday
Return the previous date that matches a weekday number
Counts occurrences of a weekday between two dates
Returns the weekday name for a given date
Determine if a date falls within a start and end date
Returns TRUE if two date ranges overlap
Named functions enable the creation of custom, reusable formulas that mimic built-in functions, streamlining calculations and data manipulations. These functions simplify complex formulas, making spreadsheets more readable and less prone to errors. By encapsulating intricate logic within a single function call, they enhance consistency across your data. Utilizing named functions reduces the need to write lengthy formulas repeatedly, thereby improving workflow efficiency and productivity in data analysis and management.
Download and import — fastest way to add the function but does not include argument descriptions and examples
Follow these simple steps to download and import a function into your spreadsheet. This method is the quickest and easiest way to add the named function to your Google Sheets document, but will not include the argument description and examples.
Once added, the function will be ready to use in your document like any other built-in function. Simply type the function name and provide the required inputs to use it in your calculations.
Copy and paste — copy and paste each property one at a time
Follow these simple steps to integrate a custom named function into your spreadsheet:
Once added, the function will be ready to use in your document like any other built-in function. Simply type the function name and provide the required inputs to use it in your calculations.