Solved

How to calculate number of months between 2 dates

Posted on 2013-01-16
7
1,732 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
7 Comments
 
LVL 46

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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Dynamic Excel Input Form 29 32
Excel VBA - triggering a Sheet event on another workbook 3 29
Excel IF formula 3 19
Msgbox tickler 10 23
Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

785 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