Moving average in a column

liiamra

Board Regular
Joined
Mar 31, 2013
Messages
50
Hi All!

This is my second question in this great forum - thanks to CircledChicken, my first question was perfectly answered.

This question should be easier I guess and it is again about referencing.

I have the following table:

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]=average(B1:B3)[/TD]
[TD]1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]=average(C2:C4)[/TD]
[TD]2[/TD]
[TD]4[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]=average(D3:D5)[/TD]
[TD]3[/TD]
[TD]5[/TD]
[TD]5[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]=average(E4:E6)[/TD]
[TD][/TD]
[TD]6[/TD]
[TD]6[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]and so on[/TD]
[TD][/TD]
[TD][/TD]
[TD]7[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]7[/TD]
[/TR]
</tbody>[/TABLE]


The thing is that I need the formula that can be used in A, so that when I copy it downward, it takes the average of the next column- but I need to select only relevant cells like it is in the above table and not the whole column as there are other data in the same sheet.

Any help is appreciated.
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Hello Tinguyen,
Thanks too much for your assistance!

It worked! but I don't understand the logic behind it- well I do understand the row()-1,3 thing, but how does it move in columns?

Is't the cell reference of B? for example B4 means the 4th column?

Thanks again and all best//
Ali
 
Upvote 0
The row()-1,3 thing does the move in columns ! :)

I'll try to explain.

In A1, you will have :
=AVERAGE(OFFSET(B1,,1-1,3))
=AVERAGE(OFFSET(B1,,0,3))
as the row of the cell A1 is 1. For the first cell, there will be a move of 0 column.

In A2, you will have :
=AVERAGE(OFFSET(B1,,2-1,3))
=AVERAGE(OFFSET(B1,,1,3))
as the row of the cell A2 is 2. The cells will therefore move 1 column to the right !

And so on.

Tin
 
Upvote 0
lollll :D

Well now the problem is not only solved but explained too :)

Thanks alot Tin - enjoy the Easter holidays!
All Best//
Ali
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top