Sum items only where times are overlapping

nicholaspars

New Member
Joined
Nov 6, 2017
Messages
10
I have seen many ways to determine overlappping times, notably using SUMPRODUCT. In my case I want to take this a step further, where I can add values of another column for each row where the start and end times overlap.

For example in the table below, for each row I would like column D to display the sum of column C for those occasions where the start time (A) and end time (B) are overlapping.

Many thanks for any pointers in how to go about this.
 

Attachments

  • overlap.JPG
    overlap.JPG
    104.6 KB · Views: 125

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.
Try
Excel Formula:
=SUMIFS(C:C,A:A,"<="&B2,B:B,">="&A2)
Not sure if that's right or not, I know in theory what I'm thinking but formulas can't be tested on screen captures (XL2BB is a much better way to post data samples, see link in my signature block below).
 
Upvote 0
Solution
Thanks Jason

I tried the formula and have attached via XL2BB, but doesn't look quite right, for example the jump in row 6 from $4,726 to $28,700 in row 7 is not feasible.


Book1
ABCD
1START TIMEEND TIMECostSUM OF OVERLAP
209/11/2020 15:31:2409/11/2020 16:04:35$1,240.00$4,163.00
309/11/2020 15:31:2409/11/2020 20:04:47$620.00$8,459.00
409/11/2020 15:36:3309/11/2020 15:49:35$1,012.00$3,378.00
509/11/2020 15:36:3309/11/2020 16:20:57$253.00$4,766.00
609/11/2020 15:36:3313/11/2020 22:20:00$253.00$28,700.00
709/11/2020 15:58:1513/11/2020 22:20:00$785.00$27,688.00
809/11/2020 16:05:1113/11/2020 22:20:00$603.00$26,448.00
909/11/2020 16:29:4309/11/2020 19:18:36$1,080.00$4,814.00
1009/11/2020 16:31:3613/11/2020 22:20:00$1,080.00$26,195.00
1109/11/2020 17:23:0713/11/2020 22:20:00$393.00$26,195.00
1209/11/2020 19:18:5909/11/2020 21:21:40$1,140.00$5,260.00
1309/11/2020 20:10:0910/11/2020 18:34:37$386.00$8,859.00
1409/11/2020 21:22:4010/11/2020 18:34:37$196.00$7,719.00
1509/11/2020 21:26:5109/11/2020 22:06:29$692.00$4,388.00
1609/11/2020 22:06:5310/11/2020 15:39:54$326.00$5,000.00
1709/11/2020 22:06:5310/11/2020 16:34:18$326.00$5,972.00
1809/11/2020 22:06:5310/11/2020 20:38:47$652.00$7,923.00
1910/11/2020 15:55:5110/11/2020 16:05:53$466.00$5,140.00
2010/11/2020 16:23:3210/11/2020 20:25:31$506.00$6,433.00
2110/11/2020 16:55:0410/11/2020 17:50:32$465.00$5,319.00
2210/11/2020 18:33:3310/11/2020 19:23:51$354.00$5,642.00
2310/11/2020 18:33:3310/11/2020 20:17:18$236.00$5,642.00
2410/11/2020 19:08:4510/11/2020 20:17:18$198.00$5,060.00
2510/11/2020 20:26:1810/11/2020 21:58:23$698.00$4,899.00
2610/11/2020 21:28:3910/11/2020 21:59:22$435.00$4,247.00
2711/11/2020 15:33:2511/11/2020 15:35:57$337.33$4,126.00
2811/11/2020 15:33:2511/11/2020 16:33:06$674.67$5,506.00
2911/11/2020 15:38:3711/11/2020 19:16:19$581.00$5,956.67
3011/11/2020 15:38:3711/11/2020 21:58:40$581.00$8,427.67
3111/11/2020 16:05:2511/11/2020 20:44:39$218.00$6,206.67
3211/11/2020 16:41:1011/11/2020 21:02:51$260.00$6,147.00
3311/11/2020 16:41:1011/11/2020 21:41:45$390.00$7,243.00
3411/11/2020 19:10:3913/11/2020 21:06:00$138.00$16,407.00
3511/11/2020 19:30:5211/11/2020 21:06:12$250.00$6,172.00
3611/11/2020 20:49:3711/11/2020 21:56:33$205.00$6,954.00
3711/11/2020 20:49:3713/11/2020 22:20:00$410.00$15,608.00
3811/11/2020 21:04:0811/11/2020 21:59:00$202.00$6,694.00
3911/11/2020 21:04:0813/11/2020 22:20:00$404.00$15,348.00
4011/11/2020 21:35:5911/11/2020 21:49:42$490.00$5,934.00
4111/11/2020 21:50:4512/11/2020 16:02:36$170.00$8,723.00
4211/11/2020 21:50:4512/11/2020 21:35:37$340.00$11,278.00
4312/11/2020 15:33:5012/11/2020 15:37:00$315.00$6,365.00
4412/11/2020 15:33:5012/11/2020 15:53:01$630.00$7,735.00
4512/11/2020 15:36:4412/11/2020 21:59:42$211.00$10,290.00
4612/11/2020 15:36:4413/11/2020 22:20:00$633.00$13,230.00
4712/11/2020 15:42:1312/11/2020 21:52:25$580.00$9,975.00
4812/11/2020 15:45:2212/11/2020 16:37:43$395.00$8,115.00
4912/11/2020 15:45:2213/11/2020 22:20:00$395.00$12,915.00
5012/11/2020 16:20:4112/11/2020 21:59:05$695.00$9,175.00
5112/11/2020 16:49:3412/11/2020 21:59:59$520.00$8,780.00
5212/11/2020 17:58:5513/11/2020 22:20:00$395.00$11,720.00
5312/11/2020 19:21:5513/11/2020 22:20:00$405.00$11,720.00
5412/11/2020 19:33:3112/11/2020 21:58:38$540.00$8,780.00
5513/11/2020 15:30:1013/11/2020 22:20:00$618.00$8,834.00
5613/11/2020 15:30:4113/11/2020 22:20:00$270.00$8,834.00
5713/11/2020 15:36:5513/11/2020 22:20:00$584.00$8,834.00
5813/11/2020 16:00:3113/11/2020 22:20:00$206.00$8,834.00
5913/11/2020 16:46:4513/11/2020 19:04:58$140.00$8,132.00
6013/11/2020 16:46:4513/11/2020 19:26:11$280.00$8,258.00
6113/11/2020 16:49:0013/11/2020 21:31:43$140.00$8,834.00
6213/11/2020 19:11:0113/11/2020 21:35:51$126.00$8,694.00
6313/11/2020 19:26:2613/11/2020 21:25:09$576.00$8,414.00
6416/11/2020 15:30:2916/11/2020 15:38:03$860.00$2,997.00
6516/11/2020 15:31:0616/11/2020 16:29:01$1,124.00$3,577.00
6616/11/2020 15:35:5817/11/2020 16:29:23$1,013.00$8,196.00
6716/11/2020 15:44:1317/11/2020 21:59:10$580.00$11,242.00
6816/11/2020 16:30:0717/11/2020 20:43:00$650.00$8,752.00
6916/11/2020 16:39:5716/11/2020 18:02:21$410.33$3,474.00
7016/11/2020 16:39:5716/11/2020 20:47:19$410.33$4,170.00
7116/11/2020 16:39:5716/11/2020 21:35:43$410.33$4,605.00
7216/11/2020 19:42:2116/11/2020 21:40:02$232.00$4,194.67
7316/11/2020 19:42:2116/11/2020 21:57:10$464.00$4,194.67
7416/11/2020 20:48:4316/11/2020 21:54:38$435.00$3,784.33
7517/11/2020 15:30:5317/11/2020 16:22:19$777.00$3,850.00
7617/11/2020 15:33:0717/11/2020 21:51:57$830.00$7,174.00
7717/11/2020 16:42:1517/11/2020 20:55:09$1,495.00$4,600.00
7817/11/2020 16:45:1319/11/2020 20:25:16$370.00$10,508.00
7917/11/2020 16:45:1320/11/2020 15:45:08$370.00$10,508.00
8017/11/2020 17:39:0317/11/2020 20:35:17$305.00$4,600.00
8117/11/2020 21:25:0217/11/2020 22:02:40$784.00$3,516.00
8217/11/2020 21:53:4620/11/2020 22:20:00$582.00$7,228.00
8318/11/2020 15:32:5120/11/2020 22:20:00$1,250.00$5,864.00
8418/11/2020 15:41:4318/11/2020 17:50:00$242.00$4,448.00
8518/11/2020 15:41:4318/11/2020 18:05:06$242.00$5,024.00
8618/11/2020 16:03:0618/11/2020 17:11:08$586.00$3,996.00
8718/11/2020 16:49:5720/11/2020 22:20:00$354.00$5,864.00
8818/11/2020 17:30:2318/11/2020 17:52:50$452.00$4,438.00
8918/11/2020 17:50:3618/11/2020 18:08:26$192.00$4,196.00
9018/11/2020 17:50:3618/11/2020 19:21:49$192.00$5,036.00
9118/11/2020 17:50:3618/11/2020 19:49:59$192.00$5,036.00
9218/11/2020 18:26:1918/11/2020 19:14:17$840.00$4,150.00
Sheet1
Cell Formulas
RangeFormula
D2:D92D2=SUMIFS([Cost],[START TIME],"<="&[@[END TIME]],[END TIME],">="&[@[START TIME]])
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:D92Expression=AND($B2="",$A2<>"")textNO
 
Upvote 0
is that what you want?
START TIMEEND TIMECost
09/11/2020 15:31:2409/11/2020 16:04:35$ 1,240.00
09/11/2020 15:31:2409/11/2020 20:04:47$ 620.00$ 1,860.00
09/11/2020 15:36:3309/11/2020 15:49:35$ 1,012.00$ 1,632.00
09/11/2020 15:36:3309/11/2020 16:20:57$ 253.00$ 1,265.00
09/11/2020 15:36:3313/11/2020 22:20:00$ 253.00$ 506.00
09/11/2020 15:58:1513/11/2020 22:20:00$ 785.00$ 1,038.00
09/11/2020 16:05:1113/11/2020 22:20:00$ 603.00$ 1,388.00
09/11/2020 16:29:4309/11/2020 19:18:36$ 1,080.00$ 1,683.00
09/11/2020 16:31:3613/11/2020 22:20:00$ 1,080.00$ 2,160.00
09/11/2020 17:23:0713/11/2020 22:20:00$ 393.00$ 1,473.00
09/11/2020 19:18:5909/11/2020 21:21:40$ 1,140.00$ 1,533.00
09/11/2020 20:10:0910/11/2020 18:34:37$ 386.00$ 1,526.00
09/11/2020 21:22:4010/11/2020 18:34:37$ 196.00$ 582.00
09/11/2020 21:26:5109/11/2020 22:06:29$ 692.00$ 888.00
09/11/2020 22:06:5310/11/2020 15:39:54$ 326.00
09/11/2020 22:06:5310/11/2020 16:34:18$ 326.00$ 652.00
09/11/2020 22:06:5310/11/2020 20:38:47$ 652.00$ 978.00
10/11/2020 15:55:5110/11/2020 16:05:53$ 466.00$ 1,118.00
10/11/2020 16:23:3210/11/2020 20:25:31$ 506.00
10/11/2020 16:55:0410/11/2020 17:50:32$ 465.00$ 971.00
10/11/2020 18:33:3310/11/2020 19:23:51$ 354.00
10/11/2020 18:33:3310/11/2020 20:17:18$ 236.00$ 590.00
10/11/2020 19:08:4510/11/2020 20:17:18$ 198.00$ 434.00
10/11/2020 20:26:1810/11/2020 21:58:23$ 698.00
10/11/2020 21:28:3910/11/2020 21:59:22$ 435.00$ 1,133.00
11/11/2020 15:33:2511/11/2020 15:35:57$ 337.33
11/11/2020 15:33:2511/11/2020 16:33:06$ 674.67$ 1,012.00
11/11/2020 15:38:3711/11/2020 19:16:19$ 581.00$ 1,255.67
11/11/2020 15:38:3711/11/2020 21:58:40$ 581.00$ 1,162.00
11/11/2020 16:05:2511/11/2020 20:44:39$ 218.00$ 799.00
11/11/2020 16:41:1011/11/2020 21:02:51$ 260.00$ 478.00
11/11/2020 16:41:1011/11/2020 21:41:45$ 390.00$ 650.00
11/11/2020 19:10:3913/11/2020 21:06:00$ 138.00$ 528.00
11/11/2020 19:30:5211/11/2020 21:06:12$ 250.00$ 388.00
11/11/2020 20:49:3711/11/2020 21:56:33$ 205.00$ 455.00
11/11/2020 20:49:3713/11/2020 22:20:00$ 410.00$ 615.00
11/11/2020 21:04:0811/11/2020 21:59:00$ 202.00$ 612.00
11/11/2020 21:04:0813/11/2020 22:20:00$ 404.00$ 606.00
11/11/2020 21:35:5911/11/2020 21:49:42$ 490.00$ 894.00
11/11/2020 21:50:4512/11/2020 16:02:36$ 170.00
11/11/2020 21:50:4512/11/2020 21:35:37$ 340.00$ 510.00
12/11/2020 15:33:5012/11/2020 15:37:00$ 315.00$ 655.00
12/11/2020 15:33:5012/11/2020 15:53:01$ 630.00$ 945.00
12/11/2020 15:36:4412/11/2020 21:59:42$ 211.00$ 841.00
12/11/2020 15:36:4413/11/2020 22:20:00$ 633.00$ 844.00
12/11/2020 15:42:1312/11/2020 21:52:25$ 580.00$ 1,213.00
12/11/2020 15:45:2212/11/2020 16:37:43$ 395.00$ 975.00
12/11/2020 15:45:2213/11/2020 22:20:00$ 395.00$ 790.00
12/11/2020 16:20:4112/11/2020 21:59:05$ 695.00$ 1,090.00
12/11/2020 16:49:3412/11/2020 21:59:59$ 520.00$ 1,215.00
12/11/2020 17:58:5513/11/2020 22:20:00$ 395.00$ 915.00
12/11/2020 19:21:5513/11/2020 22:20:00$ 405.00$ 800.00
12/11/2020 19:33:3112/11/2020 21:58:38$ 540.00$ 945.00
13/11/2020 15:30:1013/11/2020 22:20:00$ 618.00
13/11/2020 15:30:4113/11/2020 22:20:00$ 270.00$ 888.00
13/11/2020 15:36:5513/11/2020 22:20:00$ 584.00$ 854.00
13/11/2020 16:00:3113/11/2020 22:20:00$ 206.00$ 790.00
13/11/2020 16:46:4513/11/2020 19:04:58$ 140.00$ 346.00
13/11/2020 16:46:4513/11/2020 19:26:11$ 280.00$ 420.00
13/11/2020 16:49:0013/11/2020 21:31:43$ 140.00$ 420.00
13/11/2020 19:11:0113/11/2020 21:35:51$ 126.00$ 266.00
13/11/2020 19:26:2613/11/2020 21:25:09$ 576.00$ 702.00
16/11/2020 15:30:2916/11/2020 15:38:03$ 860.00
16/11/2020 15:31:0616/11/2020 16:29:01$ 1,124.00$ 1,984.00
16/11/2020 15:35:5817/11/2020 16:29:23$ 1,013.00$ 2,137.00
16/11/2020 15:44:1317/11/2020 21:59:10$ 580.00$ 1,593.00
16/11/2020 16:30:0717/11/2020 20:43:00$ 650.00$ 1,230.00
16/11/2020 16:39:5716/11/2020 18:02:21$ 410.33$ 1,060.33
16/11/2020 16:39:5716/11/2020 20:47:19$ 410.33$ 820.67
16/11/2020 16:39:5716/11/2020 21:35:43$ 410.33$ 820.67
16/11/2020 19:42:2116/11/2020 21:40:02$ 232.00$ 642.33
16/11/2020 19:42:2116/11/2020 21:57:10$ 464.00$ 696.00
16/11/2020 20:48:4316/11/2020 21:54:38$ 435.00$ 899.00
17/11/2020 15:30:5317/11/2020 16:22:19$ 777.00
17/11/2020 15:33:0717/11/2020 21:51:57$ 830.00$ 1,607.00
17/11/2020 16:42:1517/11/2020 20:55:09$ 1,495.00$ 2,325.00
17/11/2020 16:45:1319/11/2020 20:25:16$ 370.00$ 1,865.00
17/11/2020 16:45:1320/11/2020 15:45:08$ 370.00$ 740.00
17/11/2020 17:39:0317/11/2020 20:35:17$ 305.00$ 675.00
17/11/2020 21:25:0217/11/2020 22:02:40$ 784.00
17/11/2020 21:53:4620/11/2020 22:20:00$ 582.00$ 1,366.00
18/11/2020 15:32:5120/11/2020 22:20:00$ 1,250.00$ 1,832.00
18/11/2020 15:41:4318/11/2020 17:50:00$ 242.00$ 1,492.00
18/11/2020 15:41:4318/11/2020 18:05:06$ 242.00$ 484.00
18/11/2020 16:03:0618/11/2020 17:11:08$ 586.00$ 828.00
18/11/2020 16:49:5720/11/2020 22:20:00$ 354.00$ 940.00
18/11/2020 17:30:2318/11/2020 17:52:50$ 452.00$ 806.00
18/11/2020 17:50:3618/11/2020 18:08:26$ 192.00$ 644.00
18/11/2020 17:50:3618/11/2020 19:21:49$ 192.00$ 384.00
18/11/2020 17:50:3618/11/2020 19:49:59$ 192.00$ 384.00
18/11/2020 18:26:1918/11/2020 19:14:17$ 840.00$ 1,032.00
 
Upvote 0
is that what you want?
START TIMEEND TIMECost
09/11/2020 15:31:2409/11/2020 16:04:35$ 1,240.00
09/11/2020 15:31:2409/11/2020 20:04:47$ 620.00$ 1,860.00
09/11/2020 15:36:3309/11/2020 15:49:35$ 1,012.00$ 1,632.00
09/11/2020 15:36:3309/11/2020 16:20:57$ 253.00$ 1,265.00
09/11/2020 15:36:3313/11/2020 22:20:00$ 253.00$ 506.00
09/11/2020 15:58:1513/11/2020 22:20:00$ 785.00$ 1,038.00
09/11/2020 16:05:1113/11/2020 22:20:00$ 603.00$ 1,388.00
09/11/2020 16:29:4309/11/2020 19:18:36$ 1,080.00$ 1,683.00
09/11/2020 16:31:3613/11/2020 22:20:00$ 1,080.00$ 2,160.00
09/11/2020 17:23:0713/11/2020 22:20:00$ 393.00$ 1,473.00
09/11/2020 19:18:5909/11/2020 21:21:40$ 1,140.00$ 1,533.00
09/11/2020 20:10:0910/11/2020 18:34:37$ 386.00$ 1,526.00
09/11/2020 21:22:4010/11/2020 18:34:37$ 196.00$ 582.00
09/11/2020 21:26:5109/11/2020 22:06:29$ 692.00$ 888.00
09/11/2020 22:06:5310/11/2020 15:39:54$ 326.00
09/11/2020 22:06:5310/11/2020 16:34:18$ 326.00$ 652.00
09/11/2020 22:06:5310/11/2020 20:38:47$ 652.00$ 978.00
10/11/2020 15:55:5110/11/2020 16:05:53$ 466.00$ 1,118.00
10/11/2020 16:23:3210/11/2020 20:25:31$ 506.00
10/11/2020 16:55:0410/11/2020 17:50:32$ 465.00$ 971.00
10/11/2020 18:33:3310/11/2020 19:23:51$ 354.00
10/11/2020 18:33:3310/11/2020 20:17:18$ 236.00$ 590.00
10/11/2020 19:08:4510/11/2020 20:17:18$ 198.00$ 434.00
10/11/2020 20:26:1810/11/2020 21:58:23$ 698.00
10/11/2020 21:28:3910/11/2020 21:59:22$ 435.00$ 1,133.00
11/11/2020 15:33:2511/11/2020 15:35:57$ 337.33
11/11/2020 15:33:2511/11/2020 16:33:06$ 674.67$ 1,012.00
11/11/2020 15:38:3711/11/2020 19:16:19$ 581.00$ 1,255.67
11/11/2020 15:38:3711/11/2020 21:58:40$ 581.00$ 1,162.00
11/11/2020 16:05:2511/11/2020 20:44:39$ 218.00$ 799.00
11/11/2020 16:41:1011/11/2020 21:02:51$ 260.00$ 478.00
11/11/2020 16:41:1011/11/2020 21:41:45$ 390.00$ 650.00
11/11/2020 19:10:3913/11/2020 21:06:00$ 138.00$ 528.00
11/11/2020 19:30:5211/11/2020 21:06:12$ 250.00$ 388.00
11/11/2020 20:49:3711/11/2020 21:56:33$ 205.00$ 455.00
11/11/2020 20:49:3713/11/2020 22:20:00$ 410.00$ 615.00
11/11/2020 21:04:0811/11/2020 21:59:00$ 202.00$ 612.00
11/11/2020 21:04:0813/11/2020 22:20:00$ 404.00$ 606.00
11/11/2020 21:35:5911/11/2020 21:49:42$ 490.00$ 894.00
11/11/2020 21:50:4512/11/2020 16:02:36$ 170.00
11/11/2020 21:50:4512/11/2020 21:35:37$ 340.00$ 510.00
12/11/2020 15:33:5012/11/2020 15:37:00$ 315.00$ 655.00
12/11/2020 15:33:5012/11/2020 15:53:01$ 630.00$ 945.00
12/11/2020 15:36:4412/11/2020 21:59:42$ 211.00$ 841.00
12/11/2020 15:36:4413/11/2020 22:20:00$ 633.00$ 844.00
12/11/2020 15:42:1312/11/2020 21:52:25$ 580.00$ 1,213.00
12/11/2020 15:45:2212/11/2020 16:37:43$ 395.00$ 975.00
12/11/2020 15:45:2213/11/2020 22:20:00$ 395.00$ 790.00
12/11/2020 16:20:4112/11/2020 21:59:05$ 695.00$ 1,090.00
12/11/2020 16:49:3412/11/2020 21:59:59$ 520.00$ 1,215.00
12/11/2020 17:58:5513/11/2020 22:20:00$ 395.00$ 915.00
12/11/2020 19:21:5513/11/2020 22:20:00$ 405.00$ 800.00
12/11/2020 19:33:3112/11/2020 21:58:38$ 540.00$ 945.00
13/11/2020 15:30:1013/11/2020 22:20:00$ 618.00
13/11/2020 15:30:4113/11/2020 22:20:00$ 270.00$ 888.00
13/11/2020 15:36:5513/11/2020 22:20:00$ 584.00$ 854.00
13/11/2020 16:00:3113/11/2020 22:20:00$ 206.00$ 790.00
13/11/2020 16:46:4513/11/2020 19:04:58$ 140.00$ 346.00
13/11/2020 16:46:4513/11/2020 19:26:11$ 280.00$ 420.00
13/11/2020 16:49:0013/11/2020 21:31:43$ 140.00$ 420.00
13/11/2020 19:11:0113/11/2020 21:35:51$ 126.00$ 266.00
13/11/2020 19:26:2613/11/2020 21:25:09$ 576.00$ 702.00
16/11/2020 15:30:2916/11/2020 15:38:03$ 860.00
16/11/2020 15:31:0616/11/2020 16:29:01$ 1,124.00$ 1,984.00
16/11/2020 15:35:5817/11/2020 16:29:23$ 1,013.00$ 2,137.00
16/11/2020 15:44:1317/11/2020 21:59:10$ 580.00$ 1,593.00
16/11/2020 16:30:0717/11/2020 20:43:00$ 650.00$ 1,230.00
16/11/2020 16:39:5716/11/2020 18:02:21$ 410.33$ 1,060.33
16/11/2020 16:39:5716/11/2020 20:47:19$ 410.33$ 820.67
16/11/2020 16:39:5716/11/2020 21:35:43$ 410.33$ 820.67
16/11/2020 19:42:2116/11/2020 21:40:02$ 232.00$ 642.33
16/11/2020 19:42:2116/11/2020 21:57:10$ 464.00$ 696.00
16/11/2020 20:48:4316/11/2020 21:54:38$ 435.00$ 899.00
17/11/2020 15:30:5317/11/2020 16:22:19$ 777.00
17/11/2020 15:33:0717/11/2020 21:51:57$ 830.00$ 1,607.00
17/11/2020 16:42:1517/11/2020 20:55:09$ 1,495.00$ 2,325.00
17/11/2020 16:45:1319/11/2020 20:25:16$ 370.00$ 1,865.00
17/11/2020 16:45:1320/11/2020 15:45:08$ 370.00$ 740.00
17/11/2020 17:39:0317/11/2020 20:35:17$ 305.00$ 675.00
17/11/2020 21:25:0217/11/2020 22:02:40$ 784.00
17/11/2020 21:53:4620/11/2020 22:20:00$ 582.00$ 1,366.00
18/11/2020 15:32:5120/11/2020 22:20:00$ 1,250.00$ 1,832.00
18/11/2020 15:41:4318/11/2020 17:50:00$ 242.00$ 1,492.00
18/11/2020 15:41:4318/11/2020 18:05:06$ 242.00$ 484.00
18/11/2020 16:03:0618/11/2020 17:11:08$ 586.00$ 828.00
18/11/2020 16:49:5720/11/2020 22:20:00$ 354.00$ 940.00
18/11/2020 17:30:2318/11/2020 17:52:50$ 452.00$ 806.00
18/11/2020 17:50:3618/11/2020 18:08:26$ 192.00$ 644.00
18/11/2020 17:50:3618/11/2020 19:21:49$ 192.00$ 384.00
18/11/2020 17:50:3618/11/2020 19:49:59$ 192.00$ 384.00
18/11/2020 18:26:1918/11/2020 19:14:17$ 840.00$ 1,032.00
No, I'm trying to sum ALL instances where times overlap. The process would be:
  1. Select row 2
  2. For every row in the range find each instance where the start and end times overlap with those in A2 and B2
  3. For each of those identified overlapping rows, sum the corresponding Column C values and put that total in cell D2
  4. Select row 3 and repeat the above process until the final row
Thanks
 
Upvote 0
maybe
START TIMEEND TIMECost
09/11/2020 15:31:2409/11/2020 16:04:35$ 1,240.00$ 1,240.00
09/11/2020 15:31:2409/11/2020 20:04:47$ 620.00$ 1,240.00
09/11/2020 15:36:3309/11/2020 15:49:35$ 1,012.00$ 1,860.00
09/11/2020 15:36:3309/11/2020 16:20:57$ 253.00$ 2,872.00
09/11/2020 15:36:3313/11/2020 22:20:00$ 253.00$ 3,125.00
09/11/2020 15:58:1513/11/2020 22:20:00$ 785.00$ 3,378.00
09/11/2020 16:05:1113/11/2020 22:20:00$ 603.00$ 4,163.00
09/11/2020 16:29:4309/11/2020 19:18:36$ 1,080.00$ 4,766.00
09/11/2020 16:31:3613/11/2020 22:20:00$ 1,080.00$ 5,846.00
09/11/2020 17:23:0713/11/2020 22:20:00$ 393.00$ 6,926.00
09/11/2020 19:18:5909/11/2020 21:21:40$ 1,140.00$ 7,319.00
09/11/2020 20:10:0910/11/2020 18:34:37$ 386.00$ 8,459.00
09/11/2020 21:22:4010/11/2020 18:34:37$ 196.00$ 8,845.00
09/11/2020 21:26:5109/11/2020 22:06:29$ 692.00$ 9,041.00
09/11/2020 22:06:5310/11/2020 15:39:54$ 326.00

or try to post expected result based on your example (no less than 20 rows)
 
Last edited:
Upvote 0
Thanks Jason

I tried the formula and have attached via XL2BB, but doesn't look quite right, for example the jump in row 6 from $4,726 to $28,700 in row 7 is not feasible.


Book1
ABCD
1START TIMEEND TIMECostSUM OF OVERLAP
209/11/2020 15:31:2409/11/2020 16:04:35$1,240.00$4,163.00
309/11/2020 15:31:2409/11/2020 20:04:47$620.00$8,459.00
409/11/2020 15:36:3309/11/2020 15:49:35$1,012.00$3,378.00
509/11/2020 15:36:3309/11/2020 16:20:57$253.00$4,766.00
609/11/2020 15:36:3313/11/2020 22:20:00$253.00$28,700.00
709/11/2020 15:58:1513/11/2020 22:20:00$785.00$27,688.00
809/11/2020 16:05:1113/11/2020 22:20:00$603.00$26,448.00
909/11/2020 16:29:4309/11/2020 19:18:36$1,080.00$4,814.00
1009/11/2020 16:31:3613/11/2020 22:20:00$1,080.00$26,195.00
1109/11/2020 17:23:0713/11/2020 22:20:00$393.00$26,195.00
1209/11/2020 19:18:5909/11/2020 21:21:40$1,140.00$5,260.00
1309/11/2020 20:10:0910/11/2020 18:34:37$386.00$8,859.00
1409/11/2020 21:22:4010/11/2020 18:34:37$196.00$7,719.00
1509/11/2020 21:26:5109/11/2020 22:06:29$692.00$4,388.00
1609/11/2020 22:06:5310/11/2020 15:39:54$326.00$5,000.00
1709/11/2020 22:06:5310/11/2020 16:34:18$326.00$5,972.00
1809/11/2020 22:06:5310/11/2020 20:38:47$652.00$7,923.00
1910/11/2020 15:55:5110/11/2020 16:05:53$466.00$5,140.00
2010/11/2020 16:23:3210/11/2020 20:25:31$506.00$6,433.00
2110/11/2020 16:55:0410/11/2020 17:50:32$465.00$5,319.00
2210/11/2020 18:33:3310/11/2020 19:23:51$354.00$5,642.00
2310/11/2020 18:33:3310/11/2020 20:17:18$236.00$5,642.00
2410/11/2020 19:08:4510/11/2020 20:17:18$198.00$5,060.00
2510/11/2020 20:26:1810/11/2020 21:58:23$698.00$4,899.00
2610/11/2020 21:28:3910/11/2020 21:59:22$435.00$4,247.00
2711/11/2020 15:33:2511/11/2020 15:35:57$337.33$4,126.00
2811/11/2020 15:33:2511/11/2020 16:33:06$674.67$5,506.00
2911/11/2020 15:38:3711/11/2020 19:16:19$581.00$5,956.67
3011/11/2020 15:38:3711/11/2020 21:58:40$581.00$8,427.67
3111/11/2020 16:05:2511/11/2020 20:44:39$218.00$6,206.67
3211/11/2020 16:41:1011/11/2020 21:02:51$260.00$6,147.00
3311/11/2020 16:41:1011/11/2020 21:41:45$390.00$7,243.00
3411/11/2020 19:10:3913/11/2020 21:06:00$138.00$16,407.00
3511/11/2020 19:30:5211/11/2020 21:06:12$250.00$6,172.00
3611/11/2020 20:49:3711/11/2020 21:56:33$205.00$6,954.00
3711/11/2020 20:49:3713/11/2020 22:20:00$410.00$15,608.00
3811/11/2020 21:04:0811/11/2020 21:59:00$202.00$6,694.00
3911/11/2020 21:04:0813/11/2020 22:20:00$404.00$15,348.00
4011/11/2020 21:35:5911/11/2020 21:49:42$490.00$5,934.00
4111/11/2020 21:50:4512/11/2020 16:02:36$170.00$8,723.00
4211/11/2020 21:50:4512/11/2020 21:35:37$340.00$11,278.00
4312/11/2020 15:33:5012/11/2020 15:37:00$315.00$6,365.00
4412/11/2020 15:33:5012/11/2020 15:53:01$630.00$7,735.00
4512/11/2020 15:36:4412/11/2020 21:59:42$211.00$10,290.00
4612/11/2020 15:36:4413/11/2020 22:20:00$633.00$13,230.00
4712/11/2020 15:42:1312/11/2020 21:52:25$580.00$9,975.00
4812/11/2020 15:45:2212/11/2020 16:37:43$395.00$8,115.00
4912/11/2020 15:45:2213/11/2020 22:20:00$395.00$12,915.00
5012/11/2020 16:20:4112/11/2020 21:59:05$695.00$9,175.00
5112/11/2020 16:49:3412/11/2020 21:59:59$520.00$8,780.00
5212/11/2020 17:58:5513/11/2020 22:20:00$395.00$11,720.00
5312/11/2020 19:21:5513/11/2020 22:20:00$405.00$11,720.00
5412/11/2020 19:33:3112/11/2020 21:58:38$540.00$8,780.00
5513/11/2020 15:30:1013/11/2020 22:20:00$618.00$8,834.00
5613/11/2020 15:30:4113/11/2020 22:20:00$270.00$8,834.00
5713/11/2020 15:36:5513/11/2020 22:20:00$584.00$8,834.00
5813/11/2020 16:00:3113/11/2020 22:20:00$206.00$8,834.00
5913/11/2020 16:46:4513/11/2020 19:04:58$140.00$8,132.00
6013/11/2020 16:46:4513/11/2020 19:26:11$280.00$8,258.00
6113/11/2020 16:49:0013/11/2020 21:31:43$140.00$8,834.00
6213/11/2020 19:11:0113/11/2020 21:35:51$126.00$8,694.00
6313/11/2020 19:26:2613/11/2020 21:25:09$576.00$8,414.00
6416/11/2020 15:30:2916/11/2020 15:38:03$860.00$2,997.00
6516/11/2020 15:31:0616/11/2020 16:29:01$1,124.00$3,577.00
6616/11/2020 15:35:5817/11/2020 16:29:23$1,013.00$8,196.00
6716/11/2020 15:44:1317/11/2020 21:59:10$580.00$11,242.00
6816/11/2020 16:30:0717/11/2020 20:43:00$650.00$8,752.00
6916/11/2020 16:39:5716/11/2020 18:02:21$410.33$3,474.00
7016/11/2020 16:39:5716/11/2020 20:47:19$410.33$4,170.00
7116/11/2020 16:39:5716/11/2020 21:35:43$410.33$4,605.00
7216/11/2020 19:42:2116/11/2020 21:40:02$232.00$4,194.67
7316/11/2020 19:42:2116/11/2020 21:57:10$464.00$4,194.67
7416/11/2020 20:48:4316/11/2020 21:54:38$435.00$3,784.33
7517/11/2020 15:30:5317/11/2020 16:22:19$777.00$3,850.00
7617/11/2020 15:33:0717/11/2020 21:51:57$830.00$7,174.00
7717/11/2020 16:42:1517/11/2020 20:55:09$1,495.00$4,600.00
7817/11/2020 16:45:1319/11/2020 20:25:16$370.00$10,508.00
7917/11/2020 16:45:1320/11/2020 15:45:08$370.00$10,508.00
8017/11/2020 17:39:0317/11/2020 20:35:17$305.00$4,600.00
8117/11/2020 21:25:0217/11/2020 22:02:40$784.00$3,516.00
8217/11/2020 21:53:4620/11/2020 22:20:00$582.00$7,228.00
8318/11/2020 15:32:5120/11/2020 22:20:00$1,250.00$5,864.00
8418/11/2020 15:41:4318/11/2020 17:50:00$242.00$4,448.00
8518/11/2020 15:41:4318/11/2020 18:05:06$242.00$5,024.00
8618/11/2020 16:03:0618/11/2020 17:11:08$586.00$3,996.00
8718/11/2020 16:49:5720/11/2020 22:20:00$354.00$5,864.00
8818/11/2020 17:30:2318/11/2020 17:52:50$452.00$4,438.00
8918/11/2020 17:50:3618/11/2020 18:08:26$192.00$4,196.00
9018/11/2020 17:50:3618/11/2020 19:21:49$192.00$5,036.00
9118/11/2020 17:50:3618/11/2020 19:49:59$192.00$5,036.00
9218/11/2020 18:26:1918/11/2020 19:14:17$840.00$4,150.00
Sheet1
Cell Formulas
RangeFormula
D2:D92D2=SUMIFS([Cost],[START TIME],"<="&[@[END TIME]],[END TIME],">="&[@[START TIME]])
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:D92Expression=AND($B2="",$A2<>"")textNO
Try
Excel Formula:
=SUMIFS(C:C,A:A,"<="&B2,B:B,">="&A2)
Not sure if that's right or not, I know in theory what I'm thinking but formulas can't be tested on screen captures (XL2BB is a much better way to post data samples, see link in my signature block below).
Jason

Having played around with this, your formula is in fact correctly identifying the total as requested. Many thanks for your assistance!
 
Upvote 0
I think that the results appear incorrect due to a small number of rows overlapping a much wider time range than the rest. The result of 28700 is down to the times overlapping on more than 60 rows, while the 4866 above it overlaps less than 10.

From your later reply, it looks like you figured that out but I'll keep the thread on my watch list in case you find any anomalies.
 
Upvote 0

Forum statistics

Threads
1,216,106
Messages
6,128,863
Members
449,473
Latest member
soumyahalder4

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