Automatically list years in between dates

Limone

Board Regular
Joined
Dec 20, 2018
Messages
57
Hi everyone.

I've got a table detailing employee information, including starting and expiring contract dates, with all the relative pivot tables and pie charts. I'm trying to find a way to dynamically get Excel to list every year in between the date the employee started working for us and the time their contract expired, so that the end user can eventually filter any pivot table they need by year and only get statistics that include people employed during a given time frame (e.g. "2017").

I'm open to suggestion if anyone can think of any other way to achieve the end goal (which would be filtering pivot tables by year based on starting and expiring contract dates only, no helper column).
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Based on your initial post, I am not clear on what you require.
A few ideas are included for your consideration.


Excel 2010
ABCDEFG
1Commence date5-May-102010201020102010
2Contract expired10-Jan-182018201120112011
3Years8201220122012
4201320132013
5201420142014
6201520152015
7201620162016
8201720172017
9201820182018
10   
11T201812a4b
4b
Cell Formulas
RangeFormula
E1=YEAR(MIN($B$1:$B$2))
E2=IF(E1MAX($B$1:$B$2)),E1+1,"")
E10=IF(E9MAX($B$1:$B$2)),E9+1,"")
F1=YEAR(B1)
F2=IF(F1$B$2),F1+1,"")
F10=IF(F9$B$2),F9+1,"")
G1=C1
G2=IF(G1<$C$2,G1+1,"")
G10=IF(G9<$C$2,G9+1,"")
C1=YEAR(B1)
C2=YEAR(B2)
C3=C2-C1
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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