Explanation

The DAY function returns the day component of a date.

The EOMONTH function returns the last day of the month for a given date.

Use a positive value for months to move forward in time, and a negative number…

Excel formula: Get last day of month

Excel DAY function

Excel EOMONTH function