EOMONTH


Returns the date of the last day of a month.

Syntax:

EOMONTH(startdate, addmonths)

addmonths is a number of months to be added to the startdate (given as text or a date-time serial number), to give a new date. For this new date, EOMONTH returns the date of the last day of the month, as a date-time serial number. addmonths may be positive (in the future), zero or negative (in the past).

Example:

EOMONTH("2008-02-14", 0)

returns 39507, which may be formatted as 29 Feb 08. 2008 is a leap year.

EOMONTH(A1, 2)

where cell A1 contains the date 16 Dec 07, again returns 39507, which may be formatted as 29 Feb 08.

Application:

Calculating Due Dates for Subscriptions


Let's imagine you run a subscription-based service. Your customers are billed on the 10th of each month, but you offer them a grace period, with the final payment due on the last day of the month following their billing date. The EOMONTH function is perfect for automatically calculating these due dates.


Here's an example in a table, showing how the due date is calculated for different billing dates:

Customer ID

Billing Date

Due Date (calculated)

A
B
C
1
C-101
1/10/2023
2/28/2023
2
C-102
1/10/2023
2/28/2023
3
C-103
2/10/2023
3/31/2023
4
C-104
3/10/2023
4/30/2023
5
C-105
4/10/2023
5/31/2023

How the EOMONTH function works here:

The EOMONTH function takes two arguments:

  • start_date: The date you want to start from (in this case, the Billing Date).
  • months: An integer representing the number of months to add or subtract.


In our example, we want the due date to be the last day of the month one month after the billing date. Therefore, the months argument is 1.


The formula to calculate the Due Date for the first customer would look like this:

EOMONTH(B1, 1)


  • For 2023-01-10, the function moves one month forward to February and then returns the last day of that month, 2023-02-28.
  • For 2023-02-10, it moves one month forward to March, and returns 2023-03-31.
  • The function also automatically accounts for months with different numbers of days (e.g., April has 30 days, May has 31) and even leap years.




This page is protected by Google reCAPTCHA. Privacy - Terms.
 
Built using Zapof