Spreadsheet Practice

How to check if a date is between two dates in Excel

Formula (Excel and Google Sheets)

=IF(AND(B2>=$F$1,B2<=$F$2),"Yes","No")

Test both ends with AND: =IF(AND(B2>=$F$1,B2<=$F$2),"Yes","No").

Result on the example
one result per row in C2, filled down to C7
Works in
Every current version
Google Sheets
Same formula

See it work

The formula is already in C2, filled down to C7. Change any input and the result updates, or edit the formula to experiment.

How it works

AND is TRUE only when both tests pass: on or after the start date and on or before the end date. The boundary days count, so June 1 and June 30 are inside the promotion and May 31 and July 1 are not.

=IF(AND(B2>=$F$1,B2<=$F$2),"Yes","No")

Result"No"

  1. B25/31/2026

    The value in B2.

  2. $F$16/1/2026

    The value in F1.

  3. B2>=$F$1FALSE

    The >= operator tests at least.

  4. $F$26/30/2026

    The value in F2.

  5. B2<=$F$2TRUE

    The <= operator tests at most.

  6. AND(B2>=$F$1,B2<=$F$2)FALSE

    AND: TRUE if every argument is true.

    • logical1B2>=$F$1FALSE
    • logical2B2<=$F$2TRUE
  7. IF(AND(B2>=$F$1,B2<=$F$2),"Yes","No")"No"

    IF: Returns one value if a test is true, another if false.

    • logical_testAND(B2>=$F$1,B2<=$F$2)FALSE
    • value_if_true"Yes"not used
    • value_if_false"No"

In Google Sheets

The same formula works in Google Sheets: =IF(AND(B2>=$F$1,B2<=$F$2),"Yes","No"). We ran it in Google Sheets mode on the same data and it returns the same results.

Other ways to do it

Each one was run on the same example sheet.

FormulaResultWhen to use it
=AND(B2>=$F$1,B2<=$F$2)FALSE, TRUE, TRUE…Different resultTRUE or FALSE, for filters and conditional formatting. Returns TRUE/FALSE.
=IF(MEDIAN($F$1,B2,$F$2)=B2,"Yes","No")No, Yes, Yes…MEDIAN returns the middle value of three, which is the date only when it lies inside the range.
=IF((B2>=$F$1)*(B2<=$F$2),"Yes","No")No, Yes, Yes…Multiplying the two tests is the same as AND, and it also works inside array formulas.

Common mistakes

  • With timestamps, June 30 at 3:00 PM is later than June 30 itself and fails <=$F$2. Use B2<$F$2+1.
  • Dates typed into the formula as text, like B2>="6/1/2026", compare a number with text and give the wrong answer. Keep the dates in cells or use DATE(2026,6,1).

Try it yourself

Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.

Check if a date is between two dates

In C2, show "Yes" if the check-in date is from the promo start in F1 to the promo end in F2, both days included, and "No" otherwise. Fill down to C7.

Questions

How do I count the dates between two dates?

=COUNTIFS(B2:B7,">="&F1,B2:B7,"<="&F2).

How do I check if two date ranges overlap?

They overlap when each one starts before the other ends: =AND(start1<=end2,start2<=end1).

How do I check if today falls between two dates?

Put TODAY() in the test: =IF(AND(TODAY()>=F1,TODAY()<=F2),"Promo on","Promo off").

Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.