Results 1 to 5 of 5

Thread: Formula for a rolling 24 hours total?

  1. #1
    Acolyte Nick Burns's Avatar
    Join Date
    May 2017
    Posts
    96
    Articles
    0
    Excel Version
    Office 365

    Formula for a rolling 24 hours total?



    Register for a FREE account, and/
    or Log in to avoid these ads!

    Using the sample dataset below, how can I get a rolling 24 hour total in that third column (the values below show the correct totals from the previous 24 hours)

    Date Value Rolling Total over the last 24 hours
    5/23/2020 12:00:00 PM 350 350
    5/23/2020 2:00:00 PM 86 436
    5/23/2020 5:00:00 PM 427 863
    5/23/2020 6:00:00 PM 270 1133
    5/23/2020 7:00:00 PM 305 1438
    5/23/2020 8:00:00 PM 380 1818
    5/23/2020 9:00:00 PM 17 1835
    5/23/2020 10:00:00 PM 213 2048
    5/23/2020 11:00:00 PM 317 2365
    5/24/2020 12:00:00 AM 289 2654
    5/24/2020 1:00:00 AM 261 2915
    5/24/2020 2:00:00 AM 268 3183
    5/24/2020 7:00:00 AM 77 3260
    5/24/2020 8:00:00 AM 193 3453
    5/24/2020 9:00:00 AM 334 3787
    5/24/2020 10:00:00 AM 381 4168
    5/24/2020 11:00:00 AM 233 4401
    5/24/2020 12:00:00 PM 33 4434
    5/24/2020 1:00:00 PM 130 4214
    5/24/2020 2:00:00 PM 35 4249
    5/24/2020 3:00:00 PM 170 4333
    5/24/2020 4:00:00 PM 114 4447
    5/24/2020 8:00:00 PM 221 3666
    5/24/2020 9:00:00 PM 352 3638
    5/24/2020 10:00:00 PM 320 3941
    5/24/2020 11:00:00 PM 466 4194
    5/25/2020 12:00:00 AM 167 4044
    5/25/2020 5:00:00 AM 322 3548
    5/25/2020 6:00:00 AM 371 3919
    5/25/2020 7:00:00 AM 150 4069
    5/25/2020 8:00:00 AM 17 4009
    5/25/2020 9:00:00 AM 394 4210
    5/25/2020 10:00:00 AM 288 4164
    5/25/2020 11:00:00 AM 125 3908
    Oh... by the way, YOU'RE WELCOME!

  2. #2
    Super Moderator Bob Phillips's Avatar
    Join Date
    Mar 2011
    Posts
    1,782
    Articles
    0
    Excel Version
    O365
    This should do it

    =SUMPRODUCT(--($A$2:$A2>=$A2-1),$B$2:$B2)

  3. #3
    Super Moderator Bob Phillips's Avatar
    Join Date
    Mar 2011
    Posts
    1,782
    Articles
    0
    Excel Version
    O365
    Actually, SUMIF is better, more efficient

    =SUMIF($A$2:$A2,">="&$A2-1,$B$2:$B2)

  4. #4
    Acolyte Nick Burns's Avatar
    Join Date
    May 2017
    Posts
    96
    Articles
    0
    Excel Version
    Office 365
    Perfect...I had a feeling SUMPRODUCT() would be used here, but I'm not efficient in constructing the correct syntax of that formula. I do like the use of the SUMIF() better as I can deconstruct the logic out of that better.
    Oh... by the way, YOU'RE WELCOME!

  5. #5
    Administrator Pecoflyer's Avatar
    Join Date
    Oct 2011
    Location
    Brussels Belgium
    Posts
    1,709
    Articles
    0
    Excel Version
    2010 on Xubuntu
    Have a look at Bob's page about the SUMPRODUCT function. It's very well explained. This function is very versatile
    Thank you Ken for this secure forum.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •