You are here:

Excel/dates duration formula and functions

Advertisement


Question
dates duration formula and functions
dates duration formula  
Hi Adelaide.

please refer to my attached photo for easy reference.

1. i want to find out the formula to calculate YEAR and MONTH only between 2 dates. (for e.g. 2years 2 months)

2. after finding the duration, i want to know which criteria they belong to. for example, if the duration between cell A1 and B1 is 2 years and 4 months, my cell D2 should show "between 2 to 3 years"

please help!

Answer
Vlookup
Vlookup  
Once you construct a proper lookup table on the right, a simple VLOOKUP() and use of the DATEDIF() function.

C2: =DATEDIF(A2,B2,"y") & " year(s), " & MOD(DATEDIF(A2,B2,"m"), 12) & " month(s)"
D2" =VLOOKUP(DATEDIF(A2, B2, "m"),G:H, 2, 1)

Col G     Col H
Months   criteria
0    less than 1 year
12   1 year
13   between 1 to 2 years
24   2 years
25   between 2 to 3 years
36   3 years
37   greater than 3 years


About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

Excel

All Answers


Answers by Expert:


Ask Experts

Volunteer


Jerry Beaucaire

Expertise

Excel Formulas, macros, automation. Microsoft Excel MVP - 2010. Code site with free code snippets and techniques: http://sites.madrocketscientist.com/jerrybeaucaires-excelassistant/files

Experience

Microsoft Excel MVP - 2010. I have my own extensive Excel help/code site: http://sites.madrocketscientist.com/jerrybeaucaires-excelassistant/files ===================== I have been offering free assistance as an Excel aid on many web sites for many years: (http://www.excelforum.com - JBeaucaire) ======== (http://www.askmehelpdesk.com/spreadsheets - JBeaucaire) ======= (http://www.mrexcel.com/forum - jbeaucaire)

Education/Credentials
Bachelor's Degree from Azusa Pacific University in Mathematics and Music Composition

Awards and Honors
Microsoft Excel MVP 2010

©2016 About.com. All rights reserved.