Conditional grouping and summing of data

jeffrey7

New Member
Joined
Dec 22, 2016
Messages
5
I have a dataset that looks like this:

Code:
Date         Hour    Water
1/1/2020     2       5
1/1/2020     3       45
1/1/2020     4       63
1/1/2020     24      35
1/2/2020     1       24

I want to total individual instances of the number of hours and liters. Each "hour" represents an hourly interval on my measuring device. Each "water" is the number of liters of water that flowed through the device in that hour. Thus the desired output is:

Code:
Hours   Water
3       113
2       59

If there are missing rows of dates/hours or if there is a row where water=BLANK, we should assume there was 0 water. If there are multiple consecutive hours of water, then we assume that is one instance, so I want to total the number of hours and the amount of water that flowed. Is this possible to do with standard excel syntax? I tried various combinations of IF and SUMIF but couldn't quite figure this out.
 

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.

Forum statistics

Threads
1,216,322
Messages
6,130,045
Members
449,554
Latest member
andyspa

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