Help with formula in calculating time of service
I am working on a column formula (Years of Service) to calculate the years, months and days as of TODAY from the employees’ benefits service date see formula below I am using.
=YEAR(TODAY()) - YEAR([Benefits Svc Date]@row) - IF(DATE(YEAR([Benefits Svc Date]@row), MONTH(TODAY()), DAY(TODAY())) < [Benefits Svc Date]@row, 1, 0) + " years " + IF(MONTH(TODAY()) - MONTH([Benefits Svc Date]@row) < 0, 12 + MONTH(TODAY()) - MONTH([Benefits Svc Date]@row), MONTH(TODAY()) - (MONTH([Benefits Svc Date]@row)) - 1) + " months " + IF(DAY(TODAY()) - DAY([Benefits Svc Date]@row) < 0, 30 + DAY(TODAY()) - DAY([Benefits Svc Date]@row), DAY(TODAY()) - DAY([Benefits Svc Date]@row)) + " days"
However, I am not sure I’ve got it correct. For example the two highlighted below, the one with a benefits date of 8/14/2023 is calculating 0 years -1 months 24 days, should it not be calculating 0 years 11 months 24 days? Am I missing something? Any guidance would help thank you!
Answers
-
There was a post last year about this same question. I don't know if it has the answer you are looking for; hope it helps:
Calculating Exact Days, Months & Years between 2 dates — Smartsheet Community
-
@Jeff Reisman Hello Jeff, tagging you as Pauline shared a helpful response you had on a previous similar post wondering if you had any insight?
Thanks!!
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 65K Get Help
- 441 Global Discussions
- 140 Industry Talk
- 472 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 69 Community Job Board
- 497 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!