Calculate number of months in Excel

How do I represent today less the value of cell in terms of number of months?

The below example shows my attempt
https://www.screencast.com/t/XoVirpBqlnn
Ted PennerSoftware Solutions ArchitectAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ShumsExcel & VBA ExpertCommented:
You can try below:
=MONTH(TODAY())-MONTH(F19)

Open in new window

Jeff DarlingDeveloper AnalystCommented:
=DATEDIF(NOW(),F19,"M")

Open in new window

Ted PennerSoftware Solutions ArchitectAuthor Commented:
Thank you both.

With =MONTH(TODAY())-MONTH(F19), I would end up with 3 months which is not accurate.
Your Guide to Achieving IT Business Success

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

Ted PennerSoftware Solutions ArchitectAuthor Commented:
Jeff,

Your solution appears more solid but I still get an error in the top cell.

https://www.screencast.com/t/7Z3RufemZb
Jeff DarlingDeveloper AnalystCommented:
It seems that DATEDIF doesn't like to return a negative.  so first test if greater and multiply by -1

=IF(F19>NOW(),DATEDIF(NOW(),F19,"M")*-1,DATEDIF(NOW(),F19,"M"))

Open in new window

ShumsExcel & VBA ExpertCommented:
Jeff is right, your specified date are more than today's date, try below:
=IF(DAY(NOW())>=DAY(F19),0,)+(YEAR(NOW())-YEAR(F19)) *12+MONTH(NOW())-MONTH(F19)

Open in new window

Ted PennerSoftware Solutions ArchitectAuthor Commented:
Number should always be positive and if not a positive number of months, then the value should be zero.
Jeff DarlingDeveloper AnalystCommented:
=IF(F19>NOW(),0,DATEDIF(NOW(),F19,"M"))

Open in new window

ShumsExcel & VBA ExpertCommented:
If its gonna be future dates in F column then try below:
=IF(DAY(NOW())>=DAY(F19),0,0)+(YEAR(F19)-YEAR(NOW())) *12+MONTH(F19)-MONTH(NOW())

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ted PennerSoftware Solutions ArchitectAuthor Commented:
I think the values should be 9 and 21 if not past the expiration date as shown here.

https://docs.google.com/spreadsheets/d/1cjS8qfytLJwIwbId5xfNmHm5NxsX_9gwWYxbO_B55AA/edit?usp=sharing
ShumsExcel & VBA ExpertCommented:
With my last provided solution, you are getting 9 & 21
Month Calculation
Ted PennerSoftware Solutions ArchitectAuthor Commented:
Thank you!!
ShumsExcel & VBA ExpertCommented:
Please to help!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.