Calculate Duration between dates and return results in three groups

typewriterguy

New Member
Joined
Oct 29, 2008
Messages
24
Hi. Using Excel 2003,

I have two columns of start/end dates, both in mm/dd/yyyy format

Column A is a start date
Column B is an end date

I'd like to calculate the duration between ColumnA and ColumnB and return the results as shown in one of the four duration groups below.

Duration group
0-6 months
6-12 months
12-18 months
18+ months

I started with this formula (found on this board) but realize that it won't do what I need it to do (above). Any help would be appreciated. Thanks!

=INT(TEXT(B15,"[h]")/24) &" days" & TEXT(MOD(B15,1)," h:mm")
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
<TABLE dir=ltr border=0 cellSpacing=0 cellPadding=2 width=250><TBODY><TR><TD height=19 width="29%">Start Date
</TD><TD height=19 width="32%">End Date

</TD><TD height=19 width="39%">
</TD></TR><TR><TD height=19 width="29%">1/02/2010
</TD><TD height=19 width="32%">1/08/2010
</TD><TD height=19 width="39%">0-6 months
</TD></TR><TR><TD height=19 width="29%">1/02/2004
</TD><TD height=19 width="32%">1/09/2004
</TD><TD height=19 width="39%">6-12 months
</TD></TR><TR><TD height=19 width="29%">2/02/2004
</TD><TD height=19 width="32%">2/02/2005
</TD><TD height=19 width="39%">12-18 months
</TD></TR><TR><TD height=19 width="29%">3/02/2004
</TD><TD height=19 width="32%">3/08/2005
</TD><TD height=19 width="39%">18+ months
</TD></TR><TR><TD height=19 width="29%">4/02/2004
</TD><TD height=19 width="32%">4/10/2005
</TD><TD height=19 width="39%">18+ months

</TD></TR></TBODY></TABLE>​

Try formula 1

=VLOOKUP(--DATEDIF(A2,B2,"m"),{6,"0-6 months";7,"6-12 months";12,"12-18 months";18,"18+ months"},2,1)

or Formula 2
=LOOKUP(--DATEDIF(A2,B2,"m"),{6,"0-6 months";7,"6-12 months";12,"12-18 months";18,"18+ months"})

Both formulas derive the same results.

Biz
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,935
Messages
6,122,337
Members
449,078
Latest member
skydd

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top