excel - INDEX/MATCH for closest value to a certain date -


in sheet "dividends" have table dividends sorted daily dates. e.g, columns , b contain following entries:

6/14/2015     6/13/2015     6/12/2015    0.045 6/11/2015 6/10/2015 

this means stock paid dividend of 0.045 on 6/12/2015.

in sheet "adjclose", have table weekly dates , stock prices, e.g.

6/15/2015   1.23 6/8/2015    1.24 6/1/2015    1.06 5/30/2015   1.10 5/23/2015   1.22 5/16/2015   1.20 

i compute yield, divide dividend stock price closest date of dividend payout, smaller date.

the result should be:

0.045/1.24 

how this? many input.

following 4 named ranges simplicity in code: "dividends": dividenddates (column a); dividendspaid (column b) "adjclose": stockdate (column a); stockprice (column b)

try (in column c in "dividends":

{=index(stockprice;match(max(if((stockdates<=a1);stockdates));stockdates;0))} 

assuming dividend date want find adjusted stock price in cell a1.

and copy down each dividend date. give stock price of day closest to, before, dividend date (or on date if same). devide dividend day (either in formula wrote, or in separate column. show calculations steps, easier follow.

and remember press ctrl + shift + enter when enter formula, not enter, array formula.

edit: also, need change ; , if formula separator of language.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -