Microsoft Tech Community - Latest Blogs - Excel Blog

السبت، 20 أغسطس 2022

The EOMONTH (End of Month) function accepts a date

 



The EOMONTH (End of Month) function accepts a date or a reference to a cell holding a date and produces a new date that is the last day of the month for a set number of months forward or backward in time.

For example: If we supply the date “1/15/2021” and ask for the end of the month 3 months from that date, we will produce “4/30/2021” as a result.  We move 3 months into the future then push to the end of the resultant month.


If we want the end of the current month, we inform EOMONTH to move 0 (zero) months forward.

If we want to move backward in time, we provide a negative value to the EOMONTH function.

BONUS FUNCTION

Unfortunately, Excel does not possess a BOMONTH (Beginning of Month) function, but with a bit of creativity, we can create one.

If you wanted to get the first date of the following month, you can write an EOMONTH function to calculate the end of the current month… then add a day.

ليست هناك تعليقات:

إرسال تعليق