Dapatkan hari terakhir bulan n bulan di masa depan atau masa lalu
=EOMONTH(start_date, months)
| Parameter | Deskripsi |
|---|---|
start_date |
A date that represents the start date in a valid Excel serial number format. |
months |
The number of months before or after start_date. |
With a given start date, EOMONTH returns a new date by adding the number of months provided and returning the last day of the resulting month. To illu
=EOMONTH("1-Jan-2024",2) // returns 31-Mar-2024
=EOMONTH("1-Jan-2024",5) // returns 30-Jun-2024
=EOMONTH("1-Jan-2024",8) // returns 30-Sep-2024
=EOMONTH("1-Jan-2024",11) // returns 31-Dec-2024
The first formula adds 2 months, the second adds 5 months, the third adds 8 months, and the fourth adds 11 months to the date. Although the start date
=EOMONTH(A1,2) // returns 31-Mar-2024
=EOMONTH(A1,5) // returns 30-Jun-2024
=EOMONTH(A1,8) // returns 30-Sep-2024
=EOMONTH(A1,11) // returns 31-Dec-2024
The results are the same. And if the date in A1 is changed, EOMONTH will generate new dates. You can use negative numbers for months to create dates b
=EOMONTH(A1,-1) // returns 31-Dec-2023
=EOMONTH(A1,-4) // returns 30-Sep-2023
=EOMONTH(A1,-7) // returns 30-Jun-2023
=EOMONTH(A1,-10) // returns 31-Mar-2023
With the date May 12, 2017, in cell B5, the formulas below will return the dates as noted:
=EOMONTH(B5,0) // returns May 31, 2017
=EOMONTH(B5,4) // returns Sep 30, 2017
=EOMONTH(B5,-3) // returns Feb 28, 2017
To use the EOMONTH function to move by years, multiply the months by 12. For example, to move a date forward 2 years, you can use either of these form
=EOMONTH(A1,24) // forward 2 years
=EOMONTH(A1,2*12) // forward 2 years
To get the last day of the current month, combine the TODAY function with EOMONTH like this:
=EOMONTH(TODAY(),0) // last day of current month