A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
can anyone help me or explain what the below formula means?
=VLOOKUP(MOD(A1-$A$1,18),{0,"ON";6,"OFF";7,"ON";8,"On";13,""},2)
Both. ;-)
That is a combined formula from different steps, not easy to understand. If we disassemble the parts I becomes easy and simple.
It is obvious that A1 contains a date, and A2 is the day after, so let us use this formulas in a new file:
A1: =TODAY()
A2: =A1+1
Drag it down till row 50.
The next step is to create the criteria, your roster has a length of 7 days * 4 weeks = 28 days:
B1: =MOD(A1-$A$1,28)
Drag it down till row 50.
As you see you'll get the numbers from 0 to 27 and then it starts again at 0. So all we have to do is to create a table for the VLOOKUP formula:
Means we have to start with 0 (the 1st day), then *6 days "on" 1 day "off"*means the 7th day is 6, then for three weeks, means 7, 13, 14, 20. Then have 7 days offmeans our last lookup value is 21, which is the 22th day (the lookup table is 0 based, so we have to subtract 1). Sounds complicated, just write this values into the sheet:
E1: 0
E2: 6
E3: 7
E4: 13
E5: 14
E6: 20
E7: 21
F1: a
F2: b
F3: c
F4: d
F5: e
F6: f
F7: g
I suggest not to use "on" and "off" for this, because it is easier to understand how it works. The last step is to create the VLOOKUP formula to search for the MOD values in the table:
C1: =VLOOKUP(B1,$E$1:$F$7,2)
Drag it down till row 50.
That's it.
In your file, replace the chars from a to g with "on" or "off" and you're done.
I do not recommend to combine the formula as in your sample, because it has no benefits.
Andreas.