Forum Moderators: open

Message Too Old, No Replies

EXCEL Function for Moving Average.

Basic setup

         

killroy

9:32 am on Sep 24, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I like setting up my moving average a bit different then usual. For one thing, I want the corersponding dataponding to fall in thecenter of the averaged range, so the valley and crests match up and aren't shifted.

I can set it up with a lot of labour, but since I have to do 6 columns I hoped somebody could help me with some basic macro syntax.

basicall I want to be able to say =getMovingAverage(COL) in the avg column. This should find the matching row in COL, then move 3 up and 3 down and calculate the average. If it's near the top or bottom edge it should take acordingly fewer columns, like a 4 day average.

Where do I set up this function in excel? I can figure out the commands to write th efunction, I just need a bit of help with the basic setup.

Thanks heaps.

SN

aspdaddy

10:31 pm on Sep 24, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Alt->F11 toggles code editor view - click on "This Workbook" or create a module and write subs/functions there

Alt->F8 ->Options to assign subs to keyboard shortcuts - usefull if you want to run code passing in a selected cell as parameter.

Some good excel vba examples:
http*//j-walk.com/ss/excel/tips/formulas.htm