Auto-Created Expanded Table based on Years

qlander

New Member
Joined
Dec 26, 2018
Messages
12
Office Version
  1. 2016
Platform
  1. Windows
Hi there,

Using Excel 2016 (no macro's), is it possible to create a table that automatically (via formula or PQ) expands based on starting a year?

For example, if I have a sheet that has a list of names and the starting year of each person, is it possible to create a new table that has each name for each year from the starting year to this year?

1693801371703.png
 

Attachments

  • 1693801340729.png
    1693801340729.png
    19.2 KB · Views: 1

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Ok, this took me a long while and many iterations. It may not be the most efficient, but it works.

qLander 20230905.xlsm
ABCDEFG
1Input TableResult Table
2PersonStart YearYear CountPersonYearRow Index
3James20204James20201
4Andy20222James20211
5Fred20168James20221
6Helen20186James20231
7Andy20222
8Andy20232
9Fred20163
10Fred20173
11Fred20183
12Fred20193
13Fred20203
14Fred20213
15Fred20223
16Fred20233
17Helen20184
18Helen20194
19Helen20204
20Helen20214
21Helen20224
22Helen20234
23   
24   
25   
26   
27   
28   
29   
30   
31   
32   
33  
34  
35  
36  
Sheet1
Cell Formulas
RangeFormula
E3:E36E3=IF(OR([@[Row Index]]=0,[@[Row Index]]>COUNTA(InputTbl[Person])),"",INDEX(InputTbl[Person],[@[Row Index]]))
F3:F36F3=IFERROR(IF(ISNUMBER([@[Row Index]]),INDEX(InputTbl[[Person]:[Start Year]],[@[Row Index]],2)+COUNTIF(E$2:E2,[@Person]),""),"")
G3:G32G3=IFERROR(IF(COUNTIF(G$2:G2,MAX(G2,1))<INDEX(InputTbl,MAX(G2,1),3),MAX(G2,1),IF(COUNT(G$2:G2)>=SUM(InputTbl[Year Count]),"",MAX(G2,1)+1)),"")
C3:C6C3=YEAR(NOW())-[@[Start Year]]+1
 
Upvote 0

Forum statistics

Threads
1,215,140
Messages
6,123,266
Members
449,093
Latest member
Vincent Khandagale

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