Days Between Weekday Names in Excel and Google Sheets

Published on

There isn’t a specific function to calculate the number of days between weekday names (text) in Excel or Google Sheets. This tutorial explains how to achieve this using a formula.

Assume you have data in two columns: one representing the departure weekday (e.g., “Monday”) and the other representing the arrival weekday (e.g., “Friday”). How can you calculate the duration between the departure and arrival weekdays?

Assume that the departure weekday names are in column A, beginning with cell A2, and the arrival weekday names are in column B, starting with cell B2.

Here are the step-by-step instructions for calculating the days between weekday names in Excel and Google Sheets.

Steps

In cell C2, enter the following formula:

=MATCH(A2, {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"}, 0)

This formula matches the text in cell A2 against the array of weekday names and returns its position: 1 for Monday, 2 for Tuesday, and so on up to 7 for Sunday.

In cell D2, enter the following formula:

=MATCH(B2, {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"}, 0)

This formula returns the weekday number for the text in cell B2.

Use the following formula in cell E2 to calculate the duration (number of days) between the weekday names:

=IF(D2>=C2, D2-C2, 7-C2+D2)

This formula checks whether the arrival weekday is greater than or equal to the departure weekday. If true, it subtracts the departure weekday from the arrival weekday. If false, it calculates the number of days remaining in the week after the departure weekday and then adds the arrival weekday.

Select cells C2:E2 and drag the fill handle down as needed.

Calculating Duration Between Weekday Names Using a Drag-down Formula

The formula will always return 0 or a positive number, assuming that the weekday text in column B is later in the week than the text in column A.

Dynamic Array Formula to Calculate Days Between Weekday Names

If you are using Excel 365 or a version that supports dynamic arrays and the LET function, you can use a dynamic array formula. This approach eliminates the need for helper columns and avoids dragging down the formula.

To calculate the days between the weekday names in A2:A10 (Departure) and B2:B10 (Arrival), enter the following formula in cell C2 after clearing C2:C10:

Excel:

=LET(
   start, 
      MATCH(A2:A10,{"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"}, 0), 
   end, 
      MATCH(B2:B10,{"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"}, 0), 
   IF(end>=start, end-start, 7-start+end)
)

Google Sheets:

Yes, this formula works in Google Sheets, but you need to use the ARRAYFORMULA function. Enter it as follows:

=ArrayFormula(LET(
   start, 
      MATCH(A2:A10,{"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"}, 0), 
   end, 
      MATCH(B2:B10,{"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"}, 0), 
   IF(end>=start, end-start, 7-start+end)
))

The formulas may return #N/A errors if any of the values are empty. This can be an issue when using larger ranges, such as A2:A1000 and B2:B1000, where only a few rows contain values.

To handle this, replace:

IF(end>=start,end-start,7-start+end)

with:

IFNA(IF(end>=start,end-start,7-start+end),"")

in both Excel and Google Sheets.

Resources

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.

Lookup Values Under Categories in Excel and Google Sheets

We can use a combination of XLOOKUP and VLOOKUP in both Excel and Google...

Extract Items Under a Category from the Same Column in Excel

In Excel, you can use a combination of the XLOOKUP and DROP functions to...

How to Create a Searchable Table in Excel Using the FILTER Function

Finding specific records, or rows containing the required information, is straightforward in Excel using...

Time Sequences in Excel by Minute, Hour, or Second Increments

Creating time sequences, whether by hour, minute, or second increments in Excel, can be...

More like this

Lookup Values Under Categories in Excel and Google Sheets

We can use a combination of XLOOKUP and VLOOKUP in both Excel and Google...

Display Month Names Only at Month Start (Excel & Google Sheets)

This tutorial explains how to display month names only at the start of each...

SUMIFS with XLOOKUP in Excel and Google Sheets

SUMIFS and SUMIF are infamous for producing an "argument must be a range" error...

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.