Why sensor analysis starts with the timestamps
Temperature loggers in cold rooms, vibration sensors on motors, energy meters, humidity probes in a greenhouse: IoT devices produce long columns of numbers with a timestamp next to each one. It is tempting to jump straight to the interesting questions. What was the average temperature? How long was the room too warm? Is the sensor drifting? But every one of those answers silently assumes that the readings arrived when they should. If an hour of data is missing, an average looks calmer than reality and a "time out of range" figure is simply wrong.
This free first lesson is for anyone who has to make sense of exported sensor data in Excel: facility and quality managers, maintenance engineers, operations analysts and students working with logger files. We use Northfield Cold Storage, a fictional warehouse, and sensor CR2-A in cold room 2, which promises one temperature reading every 5 minutes. The data covers the morning of 14 October 2026 from 06:00 to 08:45, exactly as in the lab above. The data is synthetic, but the problems in it are the ones real loggers have every day.
Sensors miss readings for ordinary reasons: a radio link drops out when a forklift parks in front of the gateway, a battery runs low, a gateway reboots after an update, or the network is down for a while. The first job with any sensor export is therefore always the same: check the timeline. Find the gaps, count what is missing and find the longest outage. That is what this lesson teaches.
The core concept: intervals, gaps and missing readings
Excel stores a date-time as a serial number: the whole part counts days since the start of 1900, and the decimal part is the time of day as a fraction. 06:00 is 0.25 of a day, 12:00 is 0.5. Subtracting two timestamps therefore gives a fraction of a day, and multiplying by the number of minutes per day turns it into minutes: =(A6-A5)*1440, because 24 × 60 = 1,440. For seconds you would multiply by 86,400, for hours by 24.
The interval is the time since the previous reading. On a perfect timeline every interval equals the sampling interval, here 5 minutes. A gap is an interval that is clearly longer than expected. "Clearly" matters: real clocks jitter, and a reading that arrives after 5 minutes and 20 seconds is not an outage. So instead of flagging everything above 5 minutes, the lab uses a tolerance factor: flag when interval > expected × 1.5, here 7.5 minutes. The factor sits in its own cell (B2), so you can change it without touching any formula.
Inside a gap, the number of missing readings is the number of 5-minute steps the interval spans, minus one: =ROUND(C6/$B$1,0)-1. A 15-minute interval spans three steps, but only two readings are missing, because the reading at the end of the interval did arrive. ROUND takes care of small jitter, so 15.3 minutes still counts as three steps.
| Interval | ÷ 5 min | Rounded steps | Missing readings | Flag at 7.5 min? |
|---|---|---|---|---|
| 5 min | 1 | 1 | 0 | No |
| 6.5 min (clock jitter) | 1.3 | 1 | 0 | No |
| 10 min | 2 | 2 | 1 | Yes |
| 15 min | 3 | 3 | 2 | Yes |
| 35 min | 7 | 7 | 6 | Yes |
Worked example: sensor CR2-A on 14 October
The sensor delivered 25 readings. The table shows the first and last rows and every row around a gap; the rows not shown all have a 5-minute interval, no flag and 0 missing readings. Column C holds the interval, column D the gap flag and column E the missing readings, with the formulas in the headers written for row 6 and copied down to row 29.
| Row | Time (A) | Temp °C (B) | Interval min (C) =(A6-A5)*1440 | Gap? (D) | Missing (E) =ROUND(C6/$B$1,0)-1 |
|---|---|---|---|---|---|
| 5 | 06:00 | 4.2 | – | ||
| 6 | 06:05 | 4.3 | 5 | 0 | |
| 12 | 06:35 | 4.5 | 5 | 0 | |
| 13 | 06:50 | 4.9 | 15 | GAP | 2 |
| 14 | 06:55 | 4.7 | 5 | 0 | |
| 21 | 07:30 | 4.3 | 5 | 0 | |
| 22 | 08:05 | 5.1 | 35 | GAP | 6 |
| 23 | 08:10 | 4.8 | 5 | 0 | |
| 27 | 08:30 | 4.3 | 5 | 0 | |
| 28 | 08:40 | 4.4 | 10 | GAP | 1 |
| 29 | 08:45 | 4.3 | 5 | 0 | |
| Gaps found (B31) | =COUNTIF(D6:D29,"GAP") → 3 | ||||
| Missing readings (B32) | =SUM(E6:E29) → 9 | ||||
| Longest interval (B33) | =MAX(C6:C29) → 35 min | ||||
Three gaps stand out. After the reading at 06:35 the next one arrives at 06:50, a 15-minute interval with 2 missing readings. After 07:30 nothing arrives until 08:05: a 35-minute outage with 6 missing readings. Finally, the interval from 08:30 to 08:40 is 10 minutes with 1 missing reading. In total 3 gaps and 9 missing readings, and the longest interval is 35 minutes.
Put differently: between 06:00 and 08:45 the sensor should have delivered 165 ÷ 5 + 1 = 34 readings, but delivered 25. That is 73.5 % completeness for this morning, a figure you will calculate properly in lesson 4. Notice also the reading right after the long gap: 5.1 °C at 08:05, the warmest value of the morning. It is still inside a 2–8 °C range, but nobody knows what happened during the 35 minutes before it. A gap is not just a data problem, it is a blind spot.
Choosing the expected interval and the tolerance
The expected interval comes from the device configuration, not from the data. Look it up in the logger software or the data sheet, because a sensor that has been misconfigured to report every 10 minutes would otherwise look perfectly healthy. If you have no documentation, the most common interval in the export is a good guess: =MODE.SNGL(C6:C29) returns the most frequent interval, which here is 5. Round the intervals first (see the note further down), so that tiny floating-point differences do not split the count.
The tolerance factor is a judgement call. A factor close to 1 catches every late reading but raises false alarms when the clock jitters by a few seconds. A large factor such as 3 hides single missed readings entirely, because a 10-minute interval would no longer count as a gap. A factor of 1.5 sits in the middle: anything up to 7.5 minutes is treated as on time, and the first missed reading, which creates a 10-minute interval, is always caught. If your devices report on an irregular schedule, for example only when a value changes, gap detection needs a different rule, such as a maximum silence time.
What to do with the gaps you find
Finding gaps is only half the job. The other half is deciding how later calculations treat them, and the honest answer depends on the purpose. For a quality or compliance record, never fill gaps with invented values. Report them, explain the cause if it is known, and keep the raw data unchanged. Many quality systems expect exactly that: a list of outages with start, end and duration, which is what columns A, C and D already give you.
For operational dashboards, a short gap of one or two readings is often bridged by carrying the last value forward or by linear interpolation, and that is acceptable as long as the chart or report says so. Long gaps should stay empty. For statistics, remember that a plain AVERAGE of the received readings weights the remaining readings more heavily around the gaps. Over a morning like this one the effect is small, but for a day with a six-hour outage at night it can shift a daily mean noticeably. Lesson 2 shows how resampling to hourly buckets makes those holes visible instead of hiding them.
Finally, look for patterns. One gap is an incident, but gaps that appear every day at the same time usually have a cause you can fix: a scheduled gateway reboot, a door that blocks the radio signal when it is open, a delivery truck parked in the same place every morning. A simple pivot table of gaps by hour of day, built from column D and =HOUR(A6), often points straight to it.
Step by step: building it in Excel
- Make sure column A holds real date-times, not text. Click a timestamp and look at the formula bar, or temporarily apply the General format: a real date-time shows a number such as 46309.25. If you see text, convert it first (see the tip below).
- Format the timestamps readably: select A5:A29, press Ctrl+1, choose Custom and type
yyyy-mm-dd hh:mm. - Put the settings in their own cells: the expected interval in B1 (5) and the tolerance factor in B2 (1.5). Never type these numbers into formulas.
- In C6 type
=(A6-A5)*1440. Row 6 is the first row with a previous reading, so the interval column starts one row below the data. Fill down to C29 with Ctrl+D or a double-click on the fill handle. - In D6 type
=IF(C6>$B$1*$B$2,"GAP",""). Press F4 after each settings reference to add the $ signs, then fill down. - In E6 type
=ROUND(C6/$B$1,0)-1and fill down. Normal rows show 0, gap rows show the number of missing readings. - Summarise:
=COUNTIF(D6:D29,"GAP")in B31,=SUM(E6:E29)in B32 and=MAX(C6:C29)in B33. - Make the gaps visible: select D6:D29, then Home › Conditional Formatting › Highlight Cells Rules › Text that Contains, type GAP and pick a fill colour.
- Sanity-check the timeline:
=MIN(C6:C29)should be close to 5. A 0 means a duplicate reading, a negative value means the rows are not sorted by time (Data › Sort, oldest to newest).
2026-10-14T06:05:00Z. Convert them with =DATEVALUE(LEFT(A5,10))+TIMEVALUE(MID(A5,12,8)), which works with ISO dates in most regional settings. Unix timestamps in seconds convert with =A5/86400+DATE(1970,1,1), which gives UTC time.=ROUND((A6-A5)*1440,2).
Common mistakes and how to spot them
- Forgetting the × 1440.
=A6-A5returns a fraction of a day such as 0.00347. If your intervals look tiny, multiply by 1,440 for minutes. - Multiplying by 24 instead of 1,440. That gives hours. A 5-minute interval shows as 0.083. Pick the unit that matches your sampling interval.
- Flagging without tolerance.
=IF(C6>$B$1,"GAP","")flags every reading that is a few seconds late. Symptom: dozens of one-reading "gaps" with 0 missing readings. - Forgetting the minus 1. A 15-minute interval holds three 5-minute steps but only two missing readings. Symptom: missing readings equal to the number of steps, even on normal rows, which then show 1 instead of 0.
- Relative settings references. Without $ signs, copying the flag formula down shifts B1 and B2 to empty cells, and the comparison silently becomes "greater than 0".
- Unsorted or duplicated rows. Exports from several gateways are often merged and out of order. Negative or zero intervals are the giveaway: check MIN of the interval column.
- Daylight saving time. If timestamps are in local time, the autumn clock change repeats an hour, producing a negative interval, and the spring change creates an apparent 65-minute gap. Store and analyse in UTC whenever the logger allows it.
- Joining lines across gaps in charts. A line chart that connects 07:30 and 08:05 invents a smooth curve where there is no data. Leave gaps visible.
Quick reference: functions and shortcuts used
| Function / shortcut | Use in this lesson | Example |
|---|---|---|
| Date-time subtraction × 1440 | Interval in minutes between two timestamps | =(A6-A5)*1440 |
ROUND | Number of 5-minute steps, and removing floating-point noise | =ROUND(C6/$B$1,0)-1 |
IF | Writes GAP when the interval exceeds the limit | =IF(C6>$B$1*$B$2,"GAP","") |
COUNTIF | Counts the flagged gaps | =COUNTIF(D6:D29,"GAP") |
SUM / MAX / MIN | Total missing readings, longest interval, duplicate or out-of-order check | =MAX(C6:C29) |
SUMPRODUCT | Counts gaps in one cell without helper columns | =SUMPRODUCT(--((A6:A29-A5:A28)*1440>B1*B2)) |
DATEVALUE + TIMEVALUE | Turns text timestamps into real date-times | =DATEVALUE(LEFT(A5,10))+TIMEVALUE(MID(A5,12,8)) |
| Ctrl+1 | Format Cells: custom format yyyy-mm-dd hh:mm | Make serial numbers readable |
| F4 | Makes $B$1 absolute while editing a formula | Lock the settings cells |
| Ctrl+Shift+↓ | Selects to the end of the data in a column | Fill C6 down to the last row |
Real-world uses
- Cold-chain monitoring. Warehouses and transport companies check logger files before they report temperatures. A gap during a delivery is something a customer or auditor will ask about, so it should be found and explained first.
- Predictive maintenance. A vibration or temperature sensor on a motor that keeps dropping readings is itself a warning sign, often of a failing battery or a weak radio link. Counting gaps per week shows which devices need attention.
- Energy and utility metering. Smart meters send readings at fixed intervals. Before consumption is billed or analysed, missing intervals are counted and either estimated or marked, so that totals are not understated.
- Building management. Facility teams compare the completeness of hundreds of room sensors. A floor where many sensors show the same gap at the same time usually points to a gateway or network problem, not to the sensors.
- Laboratory and greenhouse monitoring. Researchers check that a logger recorded continuously before using its data in an experiment, because a gap at the wrong moment can invalidate a run.
What you will build in the rest of this course
This first lesson is free. Lessons 2 to 20 are part of the full course, a one-time purchase of $9.90. They use the same Northfield Cold Storage sensors and build on the clean timeline from this lesson.
Lesson 2, Resampling to Hourly Averages with HOUR & AVERAGEIFS. You put 15-minute readings into hourly buckets and calculate readings per hour, hourly mean and hourly maximum, the same downsampling that dashboards do behind the scenes.
Lesson 3, Threshold Excursions: Count, Minutes & the Longest Excursion. You flag every reading outside 2–8 °C, add up the minutes out of range, find the longest excursion with a running counter and count separate excursions.
Lesson 4, Sensor Uptime & Data Completeness %. You turn the missing readings from this lesson into completeness percentages for four sensors and compare them with the uptime reported by the gateway log.
Lesson 5, Calibration Drift vs a Reference Sensor: SLOPE & FORECAST. With twelve weekly spot checks against a calibrated probe you measure how fast a sensor drifts and predict when it will leave its tolerance.
Lesson 6, Smoothing: Moving Average vs Raw Noise (with a Chart). You smooth 5-minute readings with a 30-minute moving average and see how many false alarms the raw values would trigger compared with the smoothed ones.
Lesson 7, Alert Rules with Hysteresis: ON above X, OFF below Y. You build a step table for a simple threshold alarm and a hysteresis alarm and count how many notifications each would send, a practical cure for alarm fatigue.
Lesson 8, Mid-course project: Compliance Report with Daily Status, Time in Range, MKT & a Chart. Two weeks of daily summaries become a compliance report with a status per day, time in range, the mean kinetic temperature and a min/max chart.
Summary
Before you analyse sensor values, analyse the timestamps. The interval is =(A6-A5)*1440 minutes, a gap is an interval above expected × tolerance, and the missing readings are =ROUND(interval/expected,0)-1. For sensor CR2-A that gives 3 gaps, 9 missing readings and a longest outage of 35 minutes on a single morning, information every later statistic depends on.
Now try it in the lab above: calculate the intervals in column C, flag the gaps in D, count the missing readings in E and fill in the summary in B31 to B33. The Coach checks each step.
Frequently asked questions
How do I calculate the time difference in minutes in Excel?
Subtract the earlier date-time from the later one and multiply by 1,440, the number of minutes in a day: =(A6-A5)*1440. Multiply by 24 for hours or 86,400 for seconds.
How do I find gaps in time series data in Excel?
Calculate the interval between consecutive timestamps and flag every interval above the expected interval times a tolerance factor, for example =IF(C6>$B$1*$B$2,"GAP",""). Then count the flags with COUNTIF.
How many readings are missing in a gap?
Divide the interval by the sampling interval, round to whole steps and subtract one: =ROUND(C6/$B$1,0)-1. A 15-minute interval on a 5-minute schedule hides two missing readings.
Why does my time difference show 4.9999 instead of 5?
Excel stores times as binary fractions of a day, so small floating-point errors appear. Wrap the result in ROUND, for example =ROUND((A6-A5)*1440,2), when you need exact values.
How do I convert a Unix timestamp to a date in Excel?
Divide the seconds by 86,400 and add the start date of Unix time: =A2/86400+DATE(1970,1,1). The result is in UTC, so add or subtract hours for local time if needed.
What tolerance should I use to flag sensor gaps?
A factor such as 1.5 times the sampling interval is a common practical choice, because it ignores clock jitter but catches every missed reading. Keep the factor in its own cell so you can adjust it to your device.
Keep going: IoT Sensor Data Analysis: Resampling, Thresholds, Drift & Uptime
This free lab is lesson 1 of 20. Unlock the other 19 hands-on labs, the final exam and your certificate for a one-time $9.90.
- Resampling to Hourly Averages with HOUR & AVERAGEIFS
- Threshold Excursions: Count, Minutes & the Longest Excursion
- Sensor Uptime & Data Completeness %
- Calibration Drift vs a Reference Sensor: SLOPE & FORECAST
- Smoothing: Moving Average vs Raw Noise (with a Chart)
- Alert Rules with Hysteresis: ON above X, OFF below Y
- Mid-course project: Compliance Report with Daily Status, Time in Range, MKT & a Chart
- Cleaning Raw Feeds: Duplicate Timestamps, Out-of-Order Rows & Flat Lines
- Spike Filters: Rate of Change and a Median-of-Three Repair
- Filling Short Gaps: Previous & Next Readings and Linear Interpolation
- Report-by-Exception Sensors: Time-Weighted Averages
- Redundant Probes: Spread, Median Voting & a Faulty-Probe Check
- Door Openings: Peak, Recovery Time & a Chart
- Compressor Duty Cycle, Short-Cycling & Energy from a Current Sensor
- Humidity Sensors: Dew Point & Condensation Risk
- Sensor Fleet Health: Last Seen, Battery, Signal & Packet Loss
- Alarm Delays: Only Alarm After N Readings Out of Range
- Temperature Mapping: Hot Spots, Cold Spots & the Control Probe Position
- Final Project: Monthly Monitoring Dashboard for Six Rooms with a Chart