Where start (E5) and end (E8) are named ranges. As the formula is copied down, the formula returns “x” if the date in column B is between the start and end dates.

Excel dates

Excel dates are just large serial numbers and can be used in any numeric calculation or comparison. This means we can simply compare a date to another date with a logical operator like greater than or equal (>=) or less than or equal (<=).

AND function

The main task in this example is to construct the right logical test. The first comparison is against the start date. We want to check if the date in B5 is greater than or equal (>=) to the date in cell E5, which is the named range start: The second expression needs to check if the date in B5 is less than or equal (<=) to the end date in cell E5: The goal is to check both of these conditions are TRUE at once, and for that, we use the AND function: The AND function will return TRUE when the date in B5 is greater than or equal to start AND less than equal to end. If either test fails, the AND function will return FALSE. We now have the logic we need to use with the IF function.

IF function

We start off by placing the expression above inside the IF function as the logical_test argument: Next, we add a value_if_true argument. In this case, we  want to return an “x” when a date is between two dates, so we add “x” as a text value: If the date in B5 is not between start and end, we don’t want to display anything, so we use an empty string ("") for value_if_false. The final formula in C5 is: As the formula is copied down, the formula returns “x” if the date in column B is between the start and end date. If not, the formula returns an empty string (""), which looks like an empty cell in Excel. The values returned by the IF function can be customized as desired.

Dave Bruns

Hi - I’m Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.