K
KAB
I am trying to write a macro to deal with the large amount of data I
get back from a monitoring instrument. The sensor samples at a rate of
once per second for 60 seconds and then goes to sleep for 14 minutes.
The data spans over two weeks so I have over 65,000 data points. What I
want to do is average the 60 reading I get at each sampling. I have
imported it into excel and I have recorded a macro for the first 600
data points but that's far from running the complete data set.
I have used the code below to get this far by manually replacing the
Range value with the next set to be averaged, ie. D120, D180 ect. How
can this be designed to increment the range automatically or by running
a loop until it no longer finds data to use. I do have a simple macro
to count the rows of data so the output from that could be used tell
the macro when to stop.
Range("D60").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(R[-59]C[-1]:RC[-1])"
Ideally it would be nice to have a dialog box that asked how rows are
to be averaged so it would be flexible if I change the sampling time in
the future.
Thanks for any help anyone can offer.
Kevin
get back from a monitoring instrument. The sensor samples at a rate of
once per second for 60 seconds and then goes to sleep for 14 minutes.
The data spans over two weeks so I have over 65,000 data points. What I
want to do is average the 60 reading I get at each sampling. I have
imported it into excel and I have recorded a macro for the first 600
data points but that's far from running the complete data set.
I have used the code below to get this far by manually replacing the
Range value with the next set to be averaged, ie. D120, D180 ect. How
can this be designed to increment the range automatically or by running
a loop until it no longer finds data to use. I do have a simple macro
to count the rows of data so the output from that could be used tell
the macro when to stop.
Range("D60").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(R[-59]C[-1]:RC[-1])"
Ideally it would be nice to have a dialog box that asked how rows are
to be averaged so it would be flexible if I change the sampling time in
the future.
Thanks for any help anyone can offer.
Kevin