Hi all
I'm trying to sum a set of numbers until it is bigger than a given number, then count how many numbers there were until that condition is met.
My example is to count how many trains are required to service a given pedestrian queue at a station, when the profile of boarding demand and boarding capacity of each train is a known value but which varies across the trains over time. The passengers unable to board is after the train is full and departed the station i.e. the size of the queue as soon as the train departs.
I have attached the data where I have manually calculated the correct trains required to clear a given queue associated with a train, but as an example, for station 2 train 7 departs with 826 people unable to board. It requires the next 4 trains to clear the back of this queue, as the next 4 trains have 87, 312, 312, 312 boarding capacity each. Another example is station 2 train 3 departs with 366 people unable to board, and requires the subsequent 6 trains to clear this queue (49,49,49,38,,87,312 boarding capacity from trains 4-9, until the queue associated with train 3 is cleared).
So any help to develop a formula with the smarts to replicate these numbers is what I am trying to figure out how to do. Hopefully I explained the issue and what I am after but happy to help clarify further, thanks.
Note my current formula i have manually dragged the range of board capacity to figure out how many trains were required, a manual process.
I'm trying to sum a set of numbers until it is bigger than a given number, then count how many numbers there were until that condition is met.
My example is to count how many trains are required to service a given pedestrian queue at a station, when the profile of boarding demand and boarding capacity of each train is a known value but which varies across the trains over time. The passengers unable to board is after the train is full and departed the station i.e. the size of the queue as soon as the train departs.
I have attached the data where I have manually calculated the correct trains required to clear a given queue associated with a train, but as an example, for station 2 train 7 departs with 826 people unable to board. It requires the next 4 trains to clear the back of this queue, as the next 4 trains have 87, 312, 312, 312 boarding capacity each. Another example is station 2 train 3 departs with 366 people unable to board, and requires the subsequent 6 trains to clear this queue (49,49,49,38,,87,312 boarding capacity from trains 4-9, until the queue associated with train 3 is cleared).
So any help to develop a formula with the smarts to replicate these numbers is what I am trying to figure out how to do. Hopefully I explained the issue and what I am after but happy to help clarify further, thanks.
Note my current formula i have manually dragged the range of board capacity to figure out how many trains were required, a manual process.
Queue test.xlsx | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | K | |||
3 | Passenger Unable to board | Station 1 | Station 2 | trains required to serve end of queue | Station 1 | Station 2 | |||||||
4 | Train 1 | 83 | 122 | Train 1 | 1 | 3 | |||||||
5 | Train 2 | 167 | 244 | Train 2 | 1 | 6 | |||||||
6 | Train 3 | 250 | 366 | Train 3 | 1 | 6 | |||||||
7 | Train 4 | 333 | 488 | Train 4 | 1 | 5 | |||||||
8 | Train 5 | 417 | 610 | Train 5 | 1 | 5 | |||||||
9 | Train 6 | 500 | 732 | Train 6 | 1 | 5 | |||||||
10 | Train 7 | 226 | 826 | Train 7 | 1 | 4 | |||||||
11 | Train 8 | 0 | 872 | Train 8 | 0 | 3 | |||||||
12 | Train 9 | 0 | 693 | Train 9 | 0 | 3 | |||||||
13 | Train 10 | 0 | 513 | Train 10 | 0 | 2 | |||||||
14 | Train 11 | 0 | 334 | Train 11 | 0 | 2 | |||||||
15 | Train 12 | 0 | 154 | Train 12 | 0 | 1 | |||||||
16 | Train 13 | 0 | 0 | Train 13 | 0 | 0 | |||||||
17 | Train 14 | 0 | 0 | Train 14 | 0 | 0 | |||||||
18 | Train 15 | 0 | 0 | Train 15 | |||||||||
19 | |||||||||||||
20 | Passenger Board capacity | Station 1 | Station 2 | ||||||||||
21 | Train 1 | 882 | 49 | ||||||||||
22 | Train 2 | 882 | 49 | ||||||||||
23 | Train 3 | 882 | 49 | ||||||||||
24 | Train 4 | 882 | 49 | ||||||||||
25 | Train 5 | 882 | 49 | ||||||||||
26 | Train 6 | 882 | 49 | ||||||||||
27 | Train 7 | 1023 | 38 | ||||||||||
28 | Train 8 | 1023 | 87 | ||||||||||
29 | Train 9 | 1023 | 312 | ||||||||||
30 | Train 10 | 1023 | 312 | ||||||||||
31 | Train 11 | 1023 | 312 | ||||||||||
32 | Train 12 | 1023 | 312 | ||||||||||
33 | Train 13 | 1023 | 312 | ||||||||||
34 | Train 14 | 1023 | 312 | ||||||||||
35 | Train 15 | 1023 | 312 | ||||||||||
Sheet1 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
J4:J17,K16:K17 | J4 | =ROUNDUP(C4/C22,0) |
K4,K11:K12 | K4 | =IF((SUM(D22:D24)>D4),COUNT(D22:D24),"FALSE") |
K5:K6 | K5 | =IF((SUM(D23:D28)>D5),COUNT(D23:D28),"FALSE") |
K7:K9 | K7 | =IF((SUM(D25:D29)>D7),COUNT(D25:D29),"FALSE") |
K10 | K10 | =IF((SUM(D28:D31)>D10),COUNT(D28:D31),"FALSE") |
K13:K14 | K13 | =IF((SUM(D31:D32)>D13),COUNT(D31:D32),"FALSE") |
K15 | K15 | =IF((SUM(D33)>D15),COUNT(D33),"FALSE") |