I have daily values over many years of data. I need to find the standard deviation for each day from its monthly average for the complete data set. Column a has dates, column b has values.
Prof gave vlookup as a hint.
I suggest that you clarify the assignment with the prof, and/or post the problem statement exactly as it is written in the assignment. There are several interpretations based on your brief description.
My interpretation: calculate the std dev from the monthly trailing (simple) moving average ending with each daily value.
If the data is for traded securities, I would simply use 21 trade days
for each month. So, I would put the formula =STDEVP(A2:A22)
into C22 and copy down, assuming the data starts in row 2.
(On average, there are 252 trade days per year; hence, 252/12 = 21 trades per month. The use of STDEVP v. STDEV for this purpose is debatable.)
But if you should use VLOOKUP, perhaps "each month" is defined as the data starting up to one calendar month
before. Even so, I would not use VLOOKUP. Instead, I would put the following formula into C32 and copy down:
(The use of A32-30 v. EDATE(A32,-1) is debatable. But note what EDATE returns when A32 is Mar 31 or Oct 31, for example.)