You can use EOMONTH to get the last day of a month which is a number of months before and after the start date.
It returns a number representing the future or past date from the date you have specified.
For example, if you specify 16-Jan-2016 as a start date & 5 as the number of months. And, Excel EOMONTH Function will return 30-Jun-2016 in the result. Because June is 5 months after January and last day of June is 30.
Here in the below examples we have used this EOMONTH with different types of arguments.