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 toC7 - 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"
B211/3/2026The value in B2.
$F$110/29/2026The value in F1.
B2>=$F$1TRUEThe >= operator tests at least.
$F$230The value in F2.
$F$1+$F$246354The + operator adds.
B2<=$F$1+$F$2TRUEThe <= operator tests at most.
AND(B2>=$F$1,B2<=$F$1+$F$2)TRUEAND: TRUE if every argument is true.- logical1
B2>=$F$1TRUE - logical2
B2<=$F$1+$F$2TRUE
- logical1
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_test
AND(B2>=$F$1,B2<=$F$1+$F$2)TRUE - value_if_true
"Renews soon" - value_if_false
""not used
- logical_test
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.
| Formula | Result | When 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 result | Labels past dates too, when expired contracts need attention. Cobalt shows "Expired". |
Common mistakes
- Testing only
B2<=$F$1+30also flags every date in the past. - Use
=TODAY()inF1for 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
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.