calculate value based on certain time intervalHello,
I need to calculate the average temperature in a cycle of 30s, and my temperature log is taking one reading every 15 sec. I recorded cycle end time, and I would like to write script to calculate the average temperature during 30s prior to the cycle end time.
| Time | Cycle End Time | Temperature |
| 6/26/2018 13:45:00 | 6/26/2018 13:46 | 22.32 |
| 6/26/2018 13:45:15 | 6/26/2018 13:46 | 22.52 |
| 6/26/2018 13:45:30 | 6/26/2018 13:46 | 22.62 |
| 6/26/2018 13:45:45 | 6/26/2018 13:46 | 22.55 |
| 6/26/2018 13:46:00 | 6/26/2018 13:46 | 22.41 |
| 6/26/2018 13:46:15 | 6/26/2018 13:48 | 22.32 |
| 6/26/2018 13:46:30 | 6/26/2018 13:48 | 22.18 |
| 6/26/2018 13:46:45 | 6/26/2018 13:48 | 22.54 |
| 6/26/2018 13:47:00 | 6/26/2018 13:48 | 22.51 |
| 6/26/2018 13:47:15 | 6/26/2018 13:48 | 22.46 |
| 6/26/2018 13:47:30 | 6/26/2018 13:48 | 22.35 |
| 6/26/2018 13:47:45 | 6/26/2018 13:48 | 22.28 |
| 6/26/2018 13:48:00 | 6/26/2018 13:48 | 22.51 |
The final table I would like is :
| Time | Cycle End Time | Temperature | Average Temperature in Cycle |
| 6/26/2018 13:45:00 | 6/26/2018 13:46 | 22.32 | 22.585 |
| 6/26/2018 13:45:15 | 6/26/2018 13:46 | 22.52 | 22.585 |
| 6/26/2018 13:45:30 | 6/26/2018 13:46 | 22.62 | 22.585 |
| 6/26/2018 13:45:45 | 6/26/2018 13:46 | 22.55 | 22.585 |
| 6/26/2018 13:46:00 | 6/26/2018 13:46 | 22.41 | 22.585 |
| 6/26/2018 13:46:15 | 6/26/2018 13:48 | 22.32 | 22.38 |
| 6/26/2018 13:46:30 | 6/26/2018 13:48 | 22.18 | 22.38 |
| 6/26/2018 13:46:45 | 6/26/2018 13:48 | 22.54 | 22.38 |
| 6/26/2018 13:47:00 | 6/26/2018 13:48 | 22.51 | 22.38 |
| 6/26/2018 13:47:15 | 6/26/2018 13:48 | 22.46 | 22.38 |
| 6/26/2018 13:47:30 | 6/26/2018 13:48 | 22.35 | 22.38 |
| 6/26/2018 13:47:45 | 6/26/2018 13:48 | 22.28 | 22.38 |
| 6/26/2018 13:48:00 | 6/26/2018 13:48 | 22.51 | 22.38 |
Does anyone know how to do that?
Re: calculate value based on certain time intervalcycle is 30 sec, for example, at 1:46pm, that's the end of cycle, so cycle start at 1:45:30pm, and same for cycle end time 1:48pm, the start time is 1:47:30pm, so any time between 1:46:00pm and 1:47:30, there is no cycle or no critical operation, which I don't need to average temperature at those time peroid.
Re: calculate value based on certain time intervalThis isn't right, but I think you can get there by modifying the formulas I used in this table. I also think your example doesn't match what you are asking for. The averages you show in what you desire appear to be for all time readings within a minute of the cycle end time, not 30 seconds. Sorry, I don't script, but you can easily get the script from my attached table - but first, you'll need to modify the formulas to get exactly what you want.