ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Slope-and Array Formula Help (https://www.excelbanter.com/excel-discussion-misc-queries/265832-slope-array-formula-help.html)

Tim Badge

Slope-and Array Formula Help
 
Im in need of help regarding producing an array formula for a kind of SlopeAnd function. I'm trying to work out an automated historical Beta using the slope function, but i need it to calculate beta for each previous historical year (starting from 2006, all the way to 2010) and have it automated via a formula without my input after i put in the formula so that when i paste in the close prices the results appear automatically. I can paste the company share prices and ftse close prices into my sheet and it automatically works out both % change columns (company % changes being y array, ftse close prices being x array for slope). the trouble im having is automating (via a formula) slope depending on the year. 2010 will be made of 2006-2010 % changes. 2009 will be made up of 2006-2009 % changes. 2008 will be made up of 2006-2008 % changes etc. so for example, if im tryin to work out 2009, i need to tell excel to slope and then only use % changes for 2006, 2007, 2008 and 2009 only. above my data i have headed columns with the year numbers 2006-2010 to reference against. iv tried an array formula for 2009 but its not working:

Formula description:
(C1 equalling "2006, D1 equalling "2007", E1 equalling "2008" etc) (E4:E237 is the year of the weekly close price, eg 2006, likewise G4:G237 is also the year of the weekly close price but for ftse, these are exactly the same as E4:E237)(F4:F237 is the company % change (y arrau), and H4:H237 is the ftse % change (x array)):

FORMULA:
{=SLOPE((IF(AND(E4:E237=C1,E4:E237=D1,E4:E237=E1,E 4:E237=F1)=FALSE,F4:F237)),(IF(AND(G4:G237=C1,G4:G 237=D1,G4:G237=E1,G4:G237=F1)=FALSE,H4:H237)))}

alternatively, iv tried using * instead of the "and" function, but its still not returning the correct values. this is what i tried for the same year (2009):

=SLOPE(IF(((E4:E237=C1)=FALSE)*((E4:E237=D1)=FALSE )*((E4:E237=E1)=FALSE)*((E4:E237=F1)=FALSE),F4:F23 7),IF(((G4:G237=C1)=FALSE)*((G4:G237=D1)=FALSE)*(( G4:G237=E1)=FALSE)*((G4:G237=F1)=FALSE),H4:H237))

iv been altering the formulas for 2 hours now and still cant get it to return the correct figures, anyone able to help please???


All times are GMT +1. The time now is 08:45 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com