Spreadsheet Practice

How to flag dates that are due in the next 30 days in Excel

Formula (Excel and Google Sheets)

=IF(AND(B2>=$F$1,B2<=$F$1+$F$2),"Renews soon","")

Test that the date is on or after today and no later than today plus the window: =IF(AND(B2>=$F$1,B2<=$F$1+$F$2),"Renews soon","").

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

Adding a number to a date moves it forward that many days, so $F$1+$F$2 is the end of the window. AND keeps dates that are on or after the start and on or before the end. Delta, exactly 30 days out, is included; Cobalt has already passed, so it isn't flagged.

=IF(AND(B2>=$F$1,B2<=$F$1+$F$2),"Renews soon","")

Result"Renews soon"

  1. B211/3/2026

    The value in B2.

  2. $F$110/29/2026

    The value in F1.

  3. B2>=$F$1TRUE

    The >= operator tests at least.

  4. $F$230

    The value in F2.

  5. $F$1+$F$246354

    The + operator adds.

  6. B2<=$F$1+$F$2TRUE

    The <= operator tests at most.

  7. AND(B2>=$F$1,B2<=$F$1+$F$2)TRUE

    AND: TRUE if every argument is true.

    • logical1B2>=$F$1TRUE
    • logical2B2<=$F$1+$F$2TRUE
  8. IF(AND(B2>=$F$1,B2<=$F$1+$F$2),"Renews soon","")"Renews soon"

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

    • logical_testAND(B2>=$F$1,B2<=$F$1+$F$2)TRUE
    • value_if_true"Renews soon"
    • value_if_false""not used

In Google Sheets

The same formula works in Google Sheets: =IF(AND(B2>=$F$1,B2<=$F$1+$F$2),"Renews soon",""). 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
=IF(AND(B2-$F$1>=0,B2-$F$1<=$F$2),"Renews soon","")Renews soon, , …The same window written as "days until renewal", which is easy to adapt into a countdown.
=IF(B2<$F$1,"Expired",IF(B2<=$F$1+$F$2,"Renews soon",""))Renews soon, , Expired…Different resultLabels past dates too, when expired contracts need attention. Cobalt shows "Expired".

Common mistakes

  • Testing only B2<=$F$1+30 also flags every date in the past.
  • Use =TODAY() in F1 for a live flag, or the window moves only when you edit the date.

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.

Flag dates that are due in the next 30 days

In C2, show "Renews soon" when the renewal date falls between the date in F1 and that date plus the days in F2, inclusive. Fill down to C7.

Questions

How do I show the number of days left?

Subtract: =B2-$F$1, formatted as a number, not a date.

How do I count contracts renewing in the window?

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

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.