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

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Forum statistics

Threads
1,225,626
Messages
6,186,092
Members
453,337
Latest member
fiaz ahmad

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