Sum total between bottle refill times

new11

New Member
Joined
Sep 15, 2020
Messages
24
Office Version
  1. 365
Platform
  1. Windows
Hello fellow excel enthusiasts 😊
I’m stuck trying to figure out a working formula or creating a better method to use, and was hoping that someone might be able to lend a hand, please.

I have a table, detailing the amount of water that has been consumed (in ml) thought the day, marked at hourly intervals, in column (I).
Column (J), records the time that the drink bottle was refilled with water. (I also have placed a small spot under the table to record this info, if that may work better for a formula)
My problem is, I don’t know how to be able to calculate the sum total of liquid that has been drank between the bottle refill times.​
For example, the total amount of water that has been consumed between the start of the day, 00:00:00, and the 1st bottle refill time at, 07:38:00, would be = 1,202ml.
Following from that, the total amount of water consumed between the 1st bottle refill time and the 2nd bottle refill time at, 11:02:00, would be = 1,188ml.​
Further, between the 2nd refill time, 11:02:00, and the 3rd refill time, 15:00:00, would be = 1,264ml. And so one so forth.​
I had tried playing around with combining if & sumifs statements, but couldn’t really think of the right direction to use.​

I’d love to hear any ideas anyone has and would greatly appreciate any help provided.
Many thanks in advance and Merry Christmas!! 🎄

dairy v1.5.xlsm
BCDEFGHIJKLMN
107Date29-Dec-23Water Bottle Size (ml)1,200mlNumber of times bottle refilledx4.0
108Day 4
109
110Time (24h)heading 1heading 2heading 3heading 4Fluid Intake (ml)Water Bottle Refill Times (24h)Liquid Drank Between Bottle Refills Notesheading 5heading 6
11100:00:00ml -1,624ml
11201:00:0010mlml 101,634ml
11302:00:00200mlml 2101,834ml
11403:00:0050mlml 2601,884ml
11504:00:00120mlml 3802,004ml
11605:00:00300mlml 6802,304ml
11706:00:00222mlml 9022,526ml
11807:00:00300ml07:38:001,202mlml 1,2022,826ml
11908:00:00264mlml 1,4663,090ml
12009:00:00240mlml 1,7063,330ml
12110:00:00363mlml 2,0693,693ml
12211:00:00321ml11:02:001,188mlml 2,3904,014ml
12312:00:00564mlml 2,9544,578ml
12413:00:00240mlml 3,1944,818ml
12514:00:00240mlml 3,4345,058ml
12615:00:00220ml15:00:001,264mlml 3,6545,278ml
12716:00:00342mlml 3,9965,620ml
12817:00:00123mlml 4,1195,743ml
12918:00:00543mlml 4,6626,286ml
13019:00:00221ml19:24:001,229mlml 4,8836,507ml
13120:00:00240mlml 5,1236,747ml
13221:00:00141mlml 5,2646,888ml
13322:00:0060mlml 5,3246,948ml
13423:00:0060mlml 5,3847,008ml
135Total0mL5,384mL
136
137Water Bottle Refill Times 07:38:0011:02:0015:00:0019:24:00
138Liquid Drank Between Times 1,202ml1,188ml1,264ml1,229ml501ml
Sheet7
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
You could try:

Cell L111:
Excel Formula:
=SCAN(0,J111:J134,LAMBDA(a,x,IF(OFFSET(x,-1,1)="",a+x,x)))

Cell J137:
Excel Formula:
=TOROW(K111:K134,1)

Cell J138:
Excel Formula:
=LET(
xl,XLOOKUP(J137#,K111:K134,L111#),
HSTACK(xl,SUM(J111:J134)-SUM(xl)))
 
Upvote 0
You could try:

Cell L111:
Excel Formula:
=SCAN(0,J111:J134,LAMBDA(a,x,IF(OFFSET(x,-1,1)="",a+x,x)))
Cell J137:
Excel Formula:
=TOROW(K111:K134,1)
Cell J138:
Excel Formula:
=LET(xl,XLOOKUP(J137#,K111:K134,L111#),HSTACK(xl,SUM(J111:J134)-SUM(xl)))

Hi Georgiboy,
Thanks for the reply :)
I've just realised that I messed up my OP, sorry.

I was meant to say that, In column K, I would like to be able to find the sum total of water drank, thats recorded in column I, between the bottle refill times listed in, column J.
At the moment in coloum K, I'm simply manually summing the range between the refill times.

I wasn't really too sure how best to word my question, but hopefully I've made a little more sense.
Cheers :)
 
Upvote 0
I thought that is what he SCAN formula I posted was doing, it creates a running total in column K that will then reset each time it see's a value in column J, therefore summing the values up to each refill point.
The only difference is the formula I have created makes a running total up to that refill point. But the value in cells K118, K122, K126, K130 will be the same as you have above.

Where I put:
Cell L111:
I should have put K111.

Maybe try clearing out column K and putting the below in K111:
Excel Formula:
=SCAN(0,J111:J134,LAMBDA(a,x,IF(OFFSET(x,-1,1)="",a+x,x)))

The other formulae were simply to catch the values from the above formula to create what you have in rows 137:138
 
Upvote 0
Solution
Where I put: L111 I should have put K111.
Maybe try clearing out column K and putting the below in K111:
Excel Formula:
=SCAN(0,J111:J134,LAMBDA(a,x,IF(OFFSET(x,-1,1)="",a+x,x)))
You sir are a genius and have saved me a lot of time in validation!!
I was using excel on my phone and had missed a few things in your earlier answer. But everything in your first formulas was all working tip top!! :)

Thanks again & Merry Christmas & a Happy NY 🎄 🎆
 
Upvote 0
You're welcome, thanks for the feedback & Happy NY to you too.
 
Upvote 0

Forum statistics

Threads
1,224,813
Messages
6,181,109
Members
453,021
Latest member
Justyna P

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