Hi,
So what I'm after is creating a vba code to calculate the 10 period moving average of the data in column B (but this is done in the background, I don't want it to write it down anywhere) it then tests if that moving average value is greater than or equal to 0.05, if the value is below 0.05 then the cell in column B is deleted and the rest of the cells are moved upwards leaving column A untouched. This keeps going on until a moving average of 0.05 or greater is achieved, the code then stops at that point.
I then want to extend this further to run through columns C, D, E, etc (depending on how many columns there are - of which the code should be able to detect automatically)
Attached is a picture to help understand the problem better.
<tbody>
</tbody>
In this case I don't want columns C and D to show (Moving average & Moving average >= 0.05? respectively)
Any help would be much appreciated.
Thanks,
Kelvin Lee
So what I'm after is creating a vba code to calculate the 10 period moving average of the data in column B (but this is done in the background, I don't want it to write it down anywhere) it then tests if that moving average value is greater than or equal to 0.05, if the value is below 0.05 then the cell in column B is deleted and the rest of the cells are moved upwards leaving column A untouched. This keeps going on until a moving average of 0.05 or greater is achieved, the code then stops at that point.
I then want to extend this further to run through columns C, D, E, etc (depending on how many columns there are - of which the code should be able to detect automatically)
Attached is a picture to help understand the problem better.
Time | Data | Moving Average | Moving average >= 0.05? | |
0 | 0.00456458384786362 |
<tbody> </tbody> | No | |
0.01 | -0.00515633489750567 |
<tbody> </tbody> | No | |
0.02 | 0.00559841936280558 |
<tbody> </tbody> | No | |
0.03 | 0.0191360829834526 |
<tbody> </tbody> | No |
<tbody>
</tbody>
In this case I don't want columns C and D to show (Moving average & Moving average >= 0.05? respectively)
Any help would be much appreciated.
Thanks,
Kelvin Lee
Last edited: