[SUMIFS] Counting number of occurrence within a time period

nocturne

New Member
Joined
Feb 27, 2019
Messages
6
Data

STARTENDVEHICLES REQUIRED
JOB 11:002:102
JOB 21:002:103
JOB 30:552:052
JOB 40:351:452
JOB 50:251:352
JOB 60:201:302
JOB 70:001:101

<colgroup><col span="3"><col></colgroup><tbody>
</tbody>
Required end product (Sheet2)

How many vehicles required at any given time?

0:000:010:020:030:040:050:200:25
Vehicles required11111135




<colgroup><col><col><col span="10"></colgroup><tbody>
</tbody>

Formula

=SUMIFS(D2:D8,B2:B8,'"<"&Sheet2!B1,C2:C8,">="&Sheet2!C1)

I cant quite get the right results. I hope i am making some sense. Appreciate the help.
 

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.
you were almost there


Book1
ABCDEFGHI
1STARTENDVEHICLES REQUIRED
2JOB 101:0002:102
3JOB 201:0002:103
4JOB 300:5502:052
5JOB 400:3501:452
6JOB 500:2501:352
7JOB 600:2001:302
8JOB 700:0001:101
9
10
1100:0000:0100:0200:0300:0400:0500:2000:25
12Vehicles required11111135
Sheet3
Cell Formulas
RangeFormula
B12=SUMIFS($D$2:$D$8,$B$2:$B$8,"<="&B$11,$C$2:$C$8,">="&B$11)
 
Upvote 0
Thanks Alan. An extension of this query, i am unable to count if the time goes before Midnight.

you were almost there

ABCDEFGHI
1STARTENDVEHICLES REQUIRED
2JOB 123:3500:102
3JOB 223:5501:103
4JOB 300:1002:052
5JOB 400:2001:452
6

<colgroup><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet3

Worksheet Formulas
CellFormula
B12=SUMIFS($D$2:$D$8,$B$2:$B$8,"<="&B$11,$C$2:$C$8,">="&B$11)

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>

Based on above data, using the same formula. It doesnt return a value of 5 for 00:00 till 00:09. It has probably got to do something with the time range. Please assist, thanks.
 
Upvote 0
Re-posting for clarity. Based on below data, using the same formula. It doesnt return a value of 5 for 00:00 but returns a value of 2 for 00:10. It has probably got to do something with the time range. Please assist, thanks.

ABCDE
1STARTENDVEHICLES REQUIRED
2JOB 123:3500:102
3JOB 223:5501:103
4JOB 300:1002:052
5JOB 400:2001:452

<tbody>
</tbody>



Worksheet Formulas
CellFormula
B12=SUMIFS($D$2:$D$8,$B$2:$B$8,"<="&B$11,$C$2:$C$8,">="&B$11)

<tbody>
</tbody>

<tbody>
</tbody>
 
Upvote 0
well, as time only, no date for the calculations excel wouldn't know if the time is started the day before.
one way to work around it is to add an helper column, as in F


Book1
ABCDE
1STARTENDVEHICLES REQUIRED
2JOB 123:3500:102-0.017
3JOB 223:5501:103-0.003
4JOB 300:1002:0520.007
5JOB 400:2001:4520.014
6JOB 5
7JOB 6
8JOB 7
9
10
1100:1000:20
12Vehicles required54
Sheet1
Cell Formulas
RangeFormula
E2=IF(B2>C2,B2-1,B2)
B12=SUMIFS($D$2:$D$8,$E$2:$E$8,"<"&B$11,$C$2:$C$8,">="&B$11)
 
Upvote 0

Forum statistics

Threads
1,214,386
Messages
6,119,214
Members
448,874
Latest member
b1step2far

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