Running Total/Sum depending on adjacent row value

kashif.alvi

New Member
Joined
Mar 15, 2012
Messages
3
My table contains data of multiple vehicles ordered by vehicle registration number and then their date-wise statuses (such as ignition on, ignition off, driving etc.) I have an odometer column which tells me the distance covered between the last status and the current status. I need to insert a running total beside this column. Its quite easy doing it for a single vehicle, however, when the next vehicle is traversed, the total keeps on running, whereas, it should start again from zero!
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Here I've posted an example below:

VehicleID Status Odo RunningODO
abc driving 1 1
abc driving 1 2
abc driving 2 4
abc driving 1 5
xyz driving 0 0
xyx driving 1 1
xyx driving 3 4
xyx driving 2 6
xyx driving 0 6
pqr driving 3 3
pqr driving 3 6

Which function do i put in the last column to calculate RunningODO
 
Upvote 0
for above table you can use this function.
=IF(A2=A1,C2+D1,C2)
but I'm sure there is another acurate way.
 
Upvote 0
Here I've posted an example below:

VehicleID Status Odo RunningODO
abc driving 1 1
abc driving 1 2
abc driving 2 4
abc driving 1 5
xyz driving 0 0
xyx driving 1 1
xyx driving 3 4
xyx driving 2 6
xyx driving 0 6
pqr driving 3 3
pqr driving 3 6

Which function do i put in the last column to calculate RunningODO
Also...

C2, copied down:

=SUMIF($A$2:A2,$A2,$B$2:B2)
 
Upvote 0
Here I've posted an example below:

VehicleID Status Odo RunningODO
abc driving 1 1
abc driving 1 2
abc driving 2 4
abc driving 1 5
xyz driving 0 0
xyx driving 1 1
xyx driving 3 4
xyx driving 2 6
xyx driving 0 6
pqr driving 3 3
pqr driving 3 6

Which function do i put in the last column to calculate RunningODO
Is this what you had in mind...

Book1
ABCD
1VehicleIDStatusOdoRunningODO
2abcdriving11
3abcdriving12
4abcdriving24
5abcdriving15
6xyzdriving00
7xyxdriving11
8xyxdriving34
9xyxdriving26
10xyxdriving06
11pqrdriving33
12pqrdriving36
Sheet1

This formula entered in D2 and copied down:

=SUMIF(A$2:A2,A2,C$2:C2)
 
Upvote 0

Forum statistics

Threads
1,215,490
Messages
6,125,094
Members
449,205
Latest member
ralemanygarcia

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