This makes the formula slightly easier to read and write.

January 1, 1900 is 1, January 2, 1900 is 2, and so on.

More recent dates are much larger numbers.

Excel formula: Get days between dates

For example, January 1, 1999 is 36161, and January 1, 2010 is 40179.

By adding 1, we include the end date in the count.

The result is 30-Jun-2024, since June 30 is earlier than July 1.

Excel MAX function

The result is 1-Jun-2024, since June 1 is later than May 1.

In other words, we use the MAX function to trap negative values and return zero instead.

Using MAX like this is a clever way to avoid using the IF function.

Excel MIN function

MAX ignores empty cells, the logical values TRUE and FALSE, and text values.

MIN Function

The Excel MIN function returns the smallest numeric value in the data provided.

The MIN function ignores empty cells, the logical values TRUE and FALSE, and text values.