Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Excel Date Falls Between Two Dates? (IF + AND)

· 4 min read · Home Tech

In this article
  1. Formula
  2. Worked Example
  3. How to Use the Formula in Excel
  4. Common Mistakes and How to Avoid Them
  5. When to Use This Formula
  6. Alternatives to IF+AND
  7. Frequently Asked Questions

To test whether a date falls between two dates in Excel, use the AND function combined with IF: =IF(AND(A2>=start,A2<=end),"Yes","No"). This returns "Yes" when the date is within the range (inclusive) and "No" otherwise. Below is a complete guide with formulas, examples, and common pitfalls.

in start | Start date | - | 2024-01-01 | 0
in end | End date | - | 2024-12-31 | 0
in check | Date to check | - | 2024-06-15 | 0
out between | Between? | - | IF(AND(check>=start,check<=end),1,0) | 0

Formula

The core formula uses AND to test two conditions simultaneously:

=IF(AND(date >= start_date, date <= end_date), "Yes", "No")

  • date – the cell containing the date you want to check.
  • start_date – the lower bound of the range (inclusive).
  • end_date – the upper bound of the range (inclusive).

If you want to exclude the endpoints (strictly between), use > and < instead of >= and <=.

Worked Example

Using the default values from the calculator:

  • Start date: 2024-01-01
  • End date: 2024-12-31
  • Date to check: 2024-06-15

Plug into the formula:

=IF(AND(2024-06-15 >= 2024-01-01, 2024-06-15 <= 2024-12-31), "Yes", "No")

Both conditions are TRUE, so the result is "Yes". The calculator block above returns 1 (meaning TRUE), which is equivalent to "Yes" when formatted as a number.

How to Use the Formula in Excel

  1. Enter your start date in cell A1, end date in B1, and the date to check in C1.
  2. In D1, type: =IF(AND(C1>=A1,C1<=B1),"Yes","No").
  3. Press Enter. The result appears immediately.
  4. Copy the formula down if you have multiple dates to check.

You can also use the MEDIAN function as a shortcut: =IF(C1=MEDIAN(A1,B1,C1),"Yes","No") – this works because MEDIAN returns the middle value; if C1 is the median, it lies between the other two. However, this fails when C1 equals both A1 and B1 (i.e., when the range is a single date), so the AND approach is safer.

Common Mistakes and How to Avoid Them

  • Text dates: If your dates are entered as text (e.g., "2024-01-01"), Excel may not compare them correctly. Use DATEVALUE or ensure cells are formatted as dates.
  • Inclusive vs. exclusive: Decide whether the endpoints count. Use >= and <= for inclusive, > and < for exclusive.
  • Wrong comparison order: The formula checks date >= start AND date <= end. Swapping them will return FALSE for all dates.
  • Hidden time components: If your dates include times (e.g., 2024-06-15 14:30), the comparison may fail for dates on the boundary. Use INT() to strip times: =IF(AND(INT(C1)>=INT(A1),INT(C1)<=INT(B1)),...).

When to Use This Formula

This pattern is useful for:

  • Flagging transactions within a billing period.
  • Filtering project tasks due between two milestones.
  • Checking if a delivery date falls within a promised window.
  • Validating date entries against a contract start/end.

You can combine it with COUNTIFS to count how many dates fall in a range, or with conditional formatting to highlight them.

Alternatives to IF+AND

  • COUNTIFS: =COUNTIFS(range,">="&start,range,"<="&end) – counts dates in range.
  • MEDIAN trick (as above) – shorter but less reliable for single-point ranges.
  • IF with nested IF – not recommended because it’s longer and error-prone.
  • Power Query – for large datasets, you can filter rows between two dates in the query editor.

Frequently Asked Questions

How do I check if a date is between two dates and return a custom value?

Replace "Yes" and "No" in the IF function with any text or number. For example: =IF(AND(C1>=A1,C1<=B1),"In range","Out of range").

What if my dates are in different rows? Can I use the formula for a whole column?

Yes. Write the formula in the first row and drag the fill handle down. Use relative references (e.g., C2, A2, B2) so each row checks its own date against its own start/end.

Does the formula work with dates stored as text?

No, not reliably. Convert text dates to real dates using DATEVALUE or the Text-to-Columns wizard. Then apply the formula.

How do I count how many dates fall between two dates?

Use COUNTIFS: =COUNTIFS(Dates,">="&A1,Dates,"<="&B1), where Dates is the range of cells containing the dates.

Can I use this formula with conditional formatting to highlight dates?

Yes. Select the date cells, go to Conditional Formatting > New Rule > Use a formula, and enter =AND(C1>=$A$1,C1<=$B$1) (adjust references). Then set a fill color.

Why does my formula return FALSE when the date is clearly within the range?

Check that all cells are formatted as dates, not text. Also verify the order of start and end – if start is later than end, the formula will always return FALSE. Use MIN and MAX to handle reversed ranges if needed.