Solved

How to calculate number of months between 2 dates

Posted on 2013-01-16
7
1,758 Views
Last Modified: 2013-01-24
I am trying to calculate the number of months between two dates.  The first date is the initial contact and the second date is the current date.  The current date will automatically update with today's date.  Then I will take that number and multiply it against a dollar amount.

Thanks in advance.
0
Comment
Question by:Vendettta
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 48

Expert Comment

by:Martin Liss
ID: 38785000
Here's a Microsoft support article.
0
 
LVL 5

Expert Comment

by:albelo
ID: 38785004
Assume you have the following in Excel

Cell A1: 6/7/2007
Cell A2: 6/9/2009

Fomula: =(YEAR(A2)-YEAR(A1))*12+MONTH(A2)-MONTH(A1)
0
 
LVL 50

Expert Comment

by:barry houdini
ID: 38785156
DATEDIF counts whole months only, e.g.

=DATEDIF(A2,B2,"m")

or do you want fractions or rounding?

To round the nearest whole number of months

=DATEDIF(A2,B2+15,"m")

regards, barry
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

Author Comment

by:Vendettta
ID: 38789677
The second date is going to be based off the system date.  Which will change automatically.  Each formula assumes a set date to be entered.  It needs to be tied to the system date.


I look forward to the update.
0
 
LVL 5

Expert Comment

by:albelo
ID: 38789707
IF you used =today() in Cell A2 it would return system date and formula would remain the
same.

or

=(YEAR(TODAY())-YEAR(A1))*12+MONTH(TODAY())-MONTH(A1)
0
 
LVL 5

Expert Comment

by:albelo
ID: 38789713
Make sure you format the cell with the formula as General or Number
0
 
LVL 50

Accepted Solution

by:
barry houdini earned 500 total points
ID: 38790042
The same applies with my DATEDIF suggestion - this formula will return the number of whole months between a date in A2 and today's date

=DATEDIF(A2,TODAY(),"m")

so if A2 = 1/1/2013 then that will give you 0 because no full months have yet passed......but if you use my other suggestion, i.e.

=DATEDIF(A2,TODAY()+15,"m")

That will round to the nearest number of months - for my example 1

...or do you want a fractional number? If you do then try YEARFRAC like this

=YEARFRAC(A2,TODAY())*12

In all of those cases you can simply multiply by your dollar amount within the same formula if you like, e.g. with dollar amount in B2 that last one becomes.

=YEARFRAC(A2,TODAY())*12*B2

If none of those work for you perhaps consider posting a few representative examples - e.g. which dates you have and what results you require for those dates.

regards, barry
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This article describes a serious pitfall that can happen when deleting shapes using VBA.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa‚Ķ

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question