ThisCalculator

Everyday

Excel Count Day of Week Between Two Dates

Updated · Standard formula, shown below

To count how many times a specific day of the week (like Monday) falls between two dates in Excel, use a formula combining SUMPRODUCT and WEEKDAY with the SEQUENCE function (in Excel 365) or an array formula in older versions. Enter your start date in A1 and end date in A2, then use =SUMPRODUCT(--(WEEKDAY(SEQUENCE(A2-A1+1,,A1,1))=2)) for Mondays, where 2 represents Monday (when return_type is 2). This article explains the formula, how it works, common pitfalls, and alternatives.

Why You Might Need This Count

Counting specific weekdays between two dates is a common need in project planning, payroll, attendance tracking, and scheduling. For example, you might need to know how many Tuesdays fall within a billing cycle, how many Fridays remain before a deadline, or how many weekends (Saturdays and Sundays) are in a vacation period. Excel does not have a built-in function dedicated to this task, but the combination of WEEKDAY and SEQUENCE (or ROW in older versions) provides a flexible solution.

The Core Formula and How It Works

In Excel 365 and Excel 2021, the SEQUENCE function generates a list of dates between your start and end dates. The WEEKDAY function then assigns a number to each date based on the day of the week. Finally, SUMPRODUCT sums the results of a comparison to count matches.

For a start date in cell A1 and an end date in A2, the formula for counting Mondays (where Monday = 2 when using return_type 2, which numbers Sunday=1 through Saturday=7) is:

=SUMPRODUCT(--(WEEKDAY(SEQUENCE(A2-A1+1,,A1,1))=2))

Here’s the breakdown:

  • SEQUENCE(A2-A1+1,,A1,1) creates a vertical array of dates from A1 to A2. The length is the number of days inclusive (end – start + 1).
  • WEEKDAY(...,2) converts each date to a number 1-7, where 1=Sunday, 2=Monday, …, 7=Saturday.
  • --(WEEKDAY(...)=2) converts TRUE/FALSE to 1/0. The double negative (–) is a common Excel trick to coerce boolean values to numbers.
  • SUMPRODUCT adds up the 1s, giving the total count.

To count a different day, change the last number: 1 for Sunday, 3 for Tuesday, 4 for Wednesday, 5 for Thursday, 6 for Friday, 7 for Saturday.

Worked Example with Default Dates

Suppose A1 = 2024-01-01 (a Monday) and A2 = 2024-01-14 (a Sunday). The formula for Mondays would be:

=SUMPRODUCT(--(WEEKDAY(SEQUENCE(14-1+1,,DATE(2024,1,1),1))=2))

Step by step:

  1. SEQUENCE(14,,DATE(2024,1,1),1) generates dates from Jan 1 to Jan 14 inclusive (14 dates).
  2. WEEKDAY(...,2) returns numbers: 1,2,3,4,5,6,7,1,2,3,4,5,6,7 for Jan 1 through Jan 14.
  3. Comparing to 2 gives TRUE for Jan 1 and Jan 8 (both Mondays), so the array becomes {TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE}.
  4. The double negative converts to {1,0,0,0,0,0,0,1,0,0,0,0,0,0}.
  5. SUMPRODUCT sums to 2.

So the result is 2 Mondays between Jan 1 and Jan 14, 2024.

Using the Formula in Older Excel Versions

If you do not have SEQUENCE (Excel 2019 and earlier), you can use an array formula with ROW and INDIRECT. For example:

=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(A1&":"&A2)))=2))

This works by creating an array of row numbers from the start date’s serial number to the end date’s serial number. Since Excel dates are stored as serial numbers, the row numbers correspond to dates. Enter it as a normal formula (SUMPRODUCT handles arrays natively), but be aware that INDIRECT is volatile and can slow down large worksheets.

Common Mistakes and How to Avoid Them

Several pitfalls can lead to incorrect results:

  • Wrong return_type: The WEEKDAY function defaults to return_type 1 (Sunday=1, Saturday=7). If you forget the second argument, Monday becomes 2, but Sunday becomes 1, which is correct for Sunday but confusing for other days. Always specify return_type 2 to make Monday=1, Tuesday=2, etc., matching the ISO standard.
  • Off-by-one errors: The SEQUENCE length must be end - start + 1 to include both dates. If you omit the +1, you’ll miss the first date.
  • Date formatting issues: If your cells contain text that looks like dates, the formula may return #VALUE!. Ensure your start and end cells are actual date values, not text.
  • Using COUNTIF with WEEKDAY: A common misconception is that COUNTIF can count weekdays directly. It cannot, because COUNTIF works on ranges, not on computed arrays. You need SUMPRODUCT or an array formula.

Alternatives and Related Formulas

If you need to count all weekdays (Monday-Friday) or weekends, you can use NETWORKDAYS for weekdays (excluding weekends and optionally holidays) or calculate weekends by subtracting weekdays from the total days. For example, total days = A2-A1+1, weekdays = NETWORKDAYS(A1,A2), weekends = total – weekdays. But for a specific day, the SUMPRODUCT method is the standard.

Another alternative is to use a helper column with a list of dates and a WEEKDAY column, then use COUNTIF. This is easier to understand but requires extra cells.

Frequently Asked Questions

How do I count all Saturdays and Sundays between two dates?

Use two separate formulas and add them: =SUMPRODUCT(--(WEEKDAY(SEQUENCE(A2-A1+1,,A1,1))=1)) + SUMPRODUCT(--(WEEKDAY(SEQUENCE(A2-A1+1,,A1,1))=7)) for Sunday (1) and Saturday (7) with return_type 2. Or calculate total days minus NETWORKDAYS(A1,A2).

Can I use this formula with a dynamic range like a table column?

Yes, replace A1 and A2 with references to cells that contain the start and end dates. If you have a list of date ranges, you can copy the formula down, but note that SEQUENCE will recalculate for each row. For large datasets, consider using a helper column or Power Query to avoid performance issues.

Why does my formula return 0 when I know there is a Monday?

Check that your start and end dates are actual dates, not text. Also verify that the day number in the formula matches the day you intend. If you use return_type 2, Monday is 2, not 1. If you accidentally use return_type 1, Monday is 1, but that also makes Sunday 1, so you might be counting the wrong day.

Is there a way to count weekdays excluding holidays?

Yes, use NETWORKDAYS with a holiday range. For example, =NETWORKDAYS(A1,A2,holidays) counts all weekdays excluding the dates in the ‘holidays’ range. This is simpler than the SUMPRODUCT method for that specific need.

Does this formula work for dates spanning multiple years?

Yes, the formula works for any date range, as long as the start date is before the end date. If the start date is after the end date, the SEQUENCE will generate an empty array and return 0. To handle reverse ranges, you can use MIN and MAX to normalize the order.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.