This is for a roster spreadsheet. I have a table (Roster) that has the data.
First column is the roster name, the next 28 columns have either a "D", "N" or white space. The next column has a date (more about that in a minute) and the last column the length of the roster in days.
The main formula is
=VLOOKUP($A5,Roster,IF(DATEDIF(VLOOKUP($A5,Roster,30),E$3,"d")-(VLOOKUP($A5,Roster,31)*INT(DATEDIF(VLOOKUP($A5,Roster,30),E$3,"d")/VLOOKUP($A5,Roster,31)))+Offset<2,VLOOKUP($A5,Roster,31),DATEDIF(VLOOKUP($A5,Roster,30),E$3,"d")-(VLOOKUP($A5,Roster,31)*INT(DATEDIF(VLOOKUP($A5,Roster,30),E$3,"d")/VLOOKUP($A5,Roster,31))))+Offset)
where cell A5 has the name of the roster, E3 thru AI3 has the date as 1/01/2014........31/01/2014 (with the cell format set to "d").
Column 31 of the table is the roster length in days.
Column 30 is "A" date where the roster would have started on January First. This is calculated back from the date the roster was implemented, which invariably is never January First.
This all works fine in the roster, but it is cumbersome working out that date when adding a new roster ( currently has 5 distinct rosters).
What I want to do is add a calculator to the tab with the table on it that, given the length of the roster and the proposed start date, will return the year that the roster would have to have started on.
Example
Roster = 5 on, 5 off, 4 on. So could be counted as a 14 day or a 28 day roster.
Start date is 13 June 2014
The begin date would be 1/01/2009
The formula uses DATEDIF() to calculate the number of days elapsed between 1/01/2009 and whatever date is being displayed.
table column pointer = days elapsed -(roster length*int(days elapsed / roster length))+ offset
The offset is 1 and is there to move the pointer past the name column in the table.
Hope this makes sense