Eliminating non-consecutive data

Agamemnon_2002

New Member
Joined
Jul 7, 2018
Messages
3
A
B
1
10:00
8
2
10:30
9
3
11:00
12
4
11:30
13
5
12:00
13
6
12:30
13
7
13:00
13
8
13:30
14
9
14:00
13
10
14:30
15
11
15:00
15
12
15:30
13
13
16:00
13
14
16:30
13
15
17:00
13
16
17:30
14
17
18:00
13
18
18:30
14
19
19:00
13
20
19:30
13
21
20:00
13
22
20:30
12
23
21:00
10
24
21:30
8

<tbody>
</tbody>

Hi,

I've been trying to write a function to eliminate certain data in a COUNTIFS with no success
Suppose I have the above data that shows how many tasks are being performed at a certain time. I want to show the peak number of tasks, but do not want to include tasks that do not occur for one hour or less (less than 2 consecutive occurrences). In this set, the peak would occur at 11:30 with 13 tasks; 14 and 15 would be eliminated because they do not occur for more than an hour.

The best I can come up with is:
COUNTIF(A1:A24,MAX(A1:A24))>2)
This eliminates 15 because it only occurs twice, but still counts 14 because it occurs three times. I want to also eliminate 14 because it does not occur for more than one consecutive hour. I also see the possibility where data may occur like this: "...,14,15,15,14,...". In this case 14 would be counted because there would be 14 tasks occurring consecutively for more than one hour.
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Hi Agamemnon_2002,

So can we say that you want to look for “buckets” of time, and then see which “bucket” has the most tasks performed?

Could you rephrase your question, so that it can be better understood by people who are not working on your project!

Why is the peak at 11:30 with 13 but not 14:30 with 15? That is how do you find the time frame with the most tasks?

Why is the 15 eliminated because it only occures twice? 12 also occurred twice?
 
Upvote 0
I couldn't build an elegant single-formula solution so I resorted to a helper column.
With your sample data in A1:B24

This helper-formula, copied down, counts consecutive values
Code:
C1: =IF(B1=B2,MATCH(0,INDEX(--(B1:B$23=B2:B$24),0),0),0)

And this regular formula returns the largest activity count that occurs for an hour or more:
Code:
D1: =INDEX(B1:B24,MATCH(MAX(INDEX((C1:C23>2)*B1:B23,0)),B1:B23,0))
Does that do what you want?
 
Upvote 0
I also see the possibility where data may occur like this: "...,14,15,15,14,...". In this case 14 would be counted because there would be 14 tasks occurring consecutively for more than one hour.

Maybe...

=MAX(INDEX(SUBTOTAL(5,OFFSET(B1,ROW(B1:B21)-ROW(B1),0,4)),0))

M.
 
Upvote 0
Marcelo's MAX INDEX SUBTOTAL OFFSET formula was exactly what I needed.

The data i provided was fictitious to simplify my problem. I also wrote Marcelo's formula into an INDEX MATCH formula to show what time this corrected peak first occurs.

What i was looking for was a way to find the MAX in column B, but I needed to find a way to eliminate essentially extraneous data that didn't really reflect the peak number of tasks (some tasks overlap and while at a certain time may show a peak of 14 or 15 in this case, they do not represent the true peak). Another way to look at it is concurrent jobs that begin and end at different times. I arbitrarily choose that tasks needed to be concurrent for 3 consecutive 30 minute periods to be counted as peak.

Hope this explained a bit better what i was looking for. I changed the height from 4 to 3 because the 4 was making the count require 4 consecutive 30 minute periods for peak instead of 3.
 
Upvote 0

Forum statistics

Threads
1,214,976
Messages
6,122,539
Members
449,088
Latest member
RandomExceller01

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