Calculate from previous row

JoeyGaspard

Board Regular
Joined
Jul 22, 2019
Messages
164
I have a table, and each row is a meter reading, I need to subtract the previous days reading to get a total usage. Here is a screenshot of the table:
1661182256585.png


I need to subtract todays meter reading from yesterdays to get a total usage for the last day? Any help on this would be great! Thanks in advance!
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
You'll need a subquery. Meter reading is actually one of the examples given here
If there can be more than one meter with that name, then you have a design problem. Same goes for if you have one table per meter.
 
Upvote 0
You'll need a subquery. Meter reading is actually one of the examples given here
If there can be more than one meter with that name, then you have a design problem. Same goes for if you have one table per meter.
There will not be duplicate meter names. I have a query that selects a start and end date (01/01/2022 and 01/02/2022), with those results I need to be able to subtract one from the other and display it on my report
 
Upvote 0
If you can do it in a report it would probably involve code in the print event. While there is a running sum feature, AFAIK there is no such thing as a running difference. Much simpler to use a subquery in your report query, methinks.
 
Upvote 0

Forum statistics

Threads
1,224,946
Messages
6,181,940
Members
453,074
Latest member
JefersonKollet

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top