Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9628

Calculate value for first day of month from values for arbitrary dates

$
0
0

I have a series of energy meter readings in a sheet, taken at various dates over the last year. So some months have multiple readings, others only 1 or 2.

Simplified example (most of my readings are any point in the month, not always the first or last day):

DATE        READING
2019-01-01  1000
2019-01-31  1100
2019-02-02  1110

I want to estimate my usage for each full calendar month.

I'll do this by averaging the difference between the last and first reading of consecutive months, over the days between them. Using this to give an estimated reading for the 1st day of each month. Once I have this entry I can easily calculate the approximate usage each month.

So in the above example I'd calculate this entry:

DATE        READING
2019-02-01  1105

= 1100 + ( (1110-1100) / 2 (days) ) * 1 (day)

This would give me a usage of 105 for January (1105 - 1000).

I could do this manually month by month but ideally I want to do it automatically for every month, regardless of how many readings there were that month, and the dates of the first and last reading.

What formals or steps would do this?

I'm thinking I'll need some of the following but not sure how I'd do then in a sheet:

  • Have a separate table with date entries for the first of each month.
  • Calculate the estimate reading for each by finding the nearest actual readings before and after that date.
  • Use those in a formula like my trivial example above.

Viewing all articles
Browse latest Browse all 9628

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>