Count number of months before/after a specified date
Here's a generic solution for counting the months from today (or other referenced date)...
In column [Months from Today] this column-formula will show the number of months before/-after the value in [TestDate], where prior months are positive and future months are negative. If [TestDate] is within the current month the result is zero (0).
=IF([TestDate]@row < TODAY(), (VALUE(MONTH(TODAY()))) + (13 - VALUE(MONTH([TestDate]@row))) + ((VALUE(YEAR(TODAY())) - VALUE(YEAR([TestDate]@row)) - 1) * 12) - 1, (VALUE(MONTH(TODAY()) - 12)) + (-VALUE(MONTH([TestDate]@row))) + ((VALUE(YEAR(TODAY())) + 1 - VALUE(YEAR([TestDate]@row))) * 12))
To compare a given date against a particular date instead of against today, replace all instances of TODAY() with that date’s cell (or summary field) reference.
Note that this does not take into account the number of days, only month values. Thus from 4/30/21 to 5/1/21 yields 1 "month" even though there's only one day difference between those dates.
Comments
-
BTW, here's how this formula might be used or adapted:
Example 1 (what it was created for): Every month the battery status for each AED on our campus needs to be checked by a designated Monitor whose desk is nearby. This formula enables us, for historical statistical review, to see how many months each of the AEDs has been in the system since installation, so we can compare that number against the number of reports submitted, and thus observe which AED Monitors have been submitting their reports consistently.
Example 2: Each employee is required to submit a monthly sales report. Mary was hired on 1/30/19 Tom was hired on 4/30/19 so they formula calculates that Mary should have submitted 27 reports and Tom 24.
Example 3: Formula could be set so that if you have a Start Date field and an End Date field you'll display the number of months between those dates. You'd need to finesse it based on whether you wanted the count to be inclusive—or not—of the start and/or end months.
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.8K Get Help
- 437 Global Discussions
- 138 Industry Talk
- 470 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 65 Community Job Board
- 486 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!