Selecting adjacent data based on conditions

learnex

New Member
Joined
Apr 12, 2011
Messages
1
Hi All,

I am trying to convert a table that looks like this:

Time; Event 1; Event 2
12:00; 0; 0
13:00 ; 0; 0
14:00 ; 10; 0
15:00 ; 4; 0
16:00 ; 5; 4
17:00 ; 3; 5
18:00 ; 5; 0
19:00 ; 0; 0
20:00 ; 0; 0
21:00; 0; 0
22:00 ; 0; 0
23:00 ; 1; 0
0:00 ; 2; 0
1:00 ; 20; 0
2:00; 0; 0

into something like this:


Events; Start time; End Time; Total
Event 1; 14:00 ; 18:00; 27
Event 1; 23:00 ; 1:00 ; 23
Event 2; 16:00; 17:00; 9

i.e. basically for every sequence an event that is non-zero, the starting time and end time is captured, and the sum of the event in this time period is calculated. Events can occur more than once for each event type (e.g. event 1 occurs twice in the time range given).

Any help would be much appreciated - excel amateur over here.

thanks,
learnex
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

Forum statistics

Threads
1,215,759
Messages
6,126,730
Members
449,333
Latest member
Adiadidas

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