you could download the worksheet below.

So many great formulas!

Thanks to everyone who took the time to submit an answer.

What formula works in E5, copied across to I5?

Below are my rambling thoughts on the problem and some of the solutions below.

Note: I never clarified how month boundaries should be handled.

I was just following another worksheet as an example.

What formula works in E5, copied across to I5?

In many cases, IF is combined with OR or AND to keep formulas compact.

See formulas by , Arun, and David below.

The Excel DAYS360 function returns the number of days between two dates based on a 360-day year.

What formula works in E5, copied across to I5?

It’s a way of calculating months based on the idea that every month has 30 days.

This is my inefficient (but elegant!)

approach using the DATE function and anarray constantwith a number for each month.

What formula works in E5, copied across to I5?

What formula works in E5, copied across to I5?