I dont really understand how those functions work. It is really the evaly and frmla functions right?
Yes.
With formulae in defined Names it's important to remember that the formula that appears in the
Name Manager will change according to which cell is the active cell on the sheet at the time you're looking at the formula there.
If you select H22 on the
DeadlineModel sheet, then go into
Name Manager you'll see that the formula for
frmla is:
=GET.CELL(6,!C22)
The C22 part of the formula is 5 columns to the left of H22 (C v. H) and in the same row (22) because the C22 part is relative both for column and row (no $ symbols).
If you do the same thing with say J29 selected, the formula appears in
Name Manager as:
=GET.CELL(6,!E29)
From these observations you can see that when you use
frmla, that it refers to a cell 5 cells to the right, and on the same row, of the cell it's used in. This is a change to the previous workbook I posted where it referred to the cell immediately to the left. This accommodates the larger table of formulae on the
Model sheet.
The same applies to
evaly.
Choose the single cell G7 on the
Report sheet then go into
Name Manager and look at the
evaly formula and you see:
=EVALUATE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(VLOOKUP(!$C7,DeadlineModel!$A$22:$J$61,COLUMN(!G7)+1,FALSE),"$I$4",MONTH(!$D7)),"$J$4",DAY(!$D7)),"$K$4",YEAR(!$D7)),"$M$4",MONTH(!$E7)),"$N$4",DAY(!$E7)),"$O$4",YEAR(!$E7)))
The result you get in that cell is the same as entering:
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(VLOOKUP($C7,DeadlineModel!$A$22:$J$61,COLUMN(G7)+1,FALSE),"$I$4",MONTH($D7)),"$J$4",DAY($D7)),"$K$4",YEAR($D7)),"$M$4",MONTH($E7)),"$N$4",DAY($E7)),"$O$4",YEAR($E7))
directly into G7.
There are 6 SUBSTITUTions going on, one for each of the 6 cells ($I$4:$K$4,$M$4:$O$4) on the
Model sheet that the formulae on that sheet refer to. The middle part of that fomula:
VLOOKUP($C7,DeadlineModel!$A$22:$J$61,COLUMN(G7)+1,FALSE)
is looking up the state ($C7) in column C in the first column of the table on the
Model sheet (DeadlineModel!$A$22:$J$61 (fully absolute references so that the same table is always used)) and returns what it finds in the 8th column of that table (COLUMN(G7)+1 (note that G7 there is the same as the selected cell so COLUMN(G7) returns 7 (from the G column, not the 7th row!) and adds 1 to it). The FALSE part of the formula is to ensure an exact match is found.
So the VLOOKUP part of the formula returns the formula string in the row corresponding to the state and the column corresponding to the deadline number.
In this case (with G7 selected) that string is Deadline2 for AZ:
=IF(DATE(
$O$4,$M$4,$N$4)<=DATE(
$O$4,6,30),DATE(
$O$4,8,15),DATE(
$O$4+1,2,15))
Here all the cell references are going to be substituted and I'll just take one of them as an example,
$O$4.
$O$4 gets substituted by
YEAR($E7), E7 contains the adjusted date July 31 2015, so
YEAR($E7) returns
2015 so the formula becomes:
=IF(DATE(
2015,$M$4,$N$4)<=DATE(
2015,6,30),DATE(
2015,8,15),DATE(
2015+1,2,15))
The same happens for the other SUBSTITUTIONS.
That's it.
There are a few things you can do to help you understand what's going on; one of them is to select a cell with
=evaly in and click the
Evaluate formula button on the
Formulas tab, then use
Step in at the first opportunity to follow the calculation steps Excel uses in the calculation.
If I can learn how to adjust this to a larger dataset I think this would be great!
For my last attachment, if there are no more than 40 states, the only enlargement required would be to copy the
evaly formulae down on the
Report sheet and fill in some data in columns C:E for the formulae to work on.
Apart from that, armed with the above notes, you should be able to tweak the defined names to accommodate the layout of your data on each sheet.