I have an excel sheet laid out like so:
+--id---+--val--+--timestamp--+
| 01 | 1.2 | 1340769912 |
|-------|-------|-------------|
| 02 | 1.6 | 1340769928 |
+-------+-------+-------------+
I’d like to get the average of values within a range of 60 seconds, or a variance of 60 in the timestamp column. I’ve tried a bunch of stuff in terms of Excel formulae, etc. but I can’t get it to work correctly. Is VBA the way to go?
EDIT: There’s a lot of data and a lot of minutes, I need this formula to work if I copy it down a column.
If you have excel 2007 or later
=AVERAGEIFS($B$1:$B$2,$C$1:$C$2,"<"&C1+60,$C$1:$C$2,">"&C1-60)for any version of excel:
=AVERAGE(IF(AND($C$1:$C$2<C1+60,$C$1:$C$2>C1-60),$B$1:$B$2))entered as an array formula using CTRL+SHIFT+ENTER to enter the formula, rather than just ENTER