The AND function takes multiple arguments and returns TRUE only when all arguments return TRUE. The TODAY function returns the current date. Dates in Excel are simply large serial numbers, so you can create a new relative date by adding or subtracting days. TODAY() + 30 creates a new date 30 days in the future, so when a days is greater than today and less than today + 30, both conditions are true, and the AND function returns true, triggering the rule.
Of course, you can adjust days to any value you like:
=AND(B4>TODAY(),B4<=(TODAY()+7)) // next 7 days =AND(B4>TODAY(),B4<=(TODAY()+45)) // next 45 days
Use other cells for input
You don't need to hard-code the dates into the rule. To make a more flexible rule, you can use other cells like variables in the formula. For example, you can name cell E2 "days" and rewrite the formula like so:
When you change either date, the conditional formatting rule will respond instantly. By using other cells for input, and naming them as named ranges, you make the conditional formatting interactive and the formula is simpler and easier to read.