+ Reply to Thread
Results 1 to 6 of 6

Summing From a Date to a Desired Cell Value

  1. #1
    Registered User
    Join Date
    10-05-2016
    Location
    Calgary, Alberta
    MS-Off Ver
    windows 7
    Posts
    20

    Summing From a Date to a Desired Cell Value

    Hello Everyone,

    I am trying to sum values in a table starting from a certain date range and ending when the values bceom zeros again. I have attached an example to better clarify. I was hoping this could be done with functions. Any help would be much appreciated!

    Thanks!
    Attached Files Attached Files
    Last edited by guy123456; 03-02-2017 at 10:33 AM.

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Summing From a Date to a Desired Cell Value

    Since you wanted a function, that is what is provided:

    In any cell put
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    it will then give you the sum starting at that date down to the first 0 it encounters.

    Please Login or Register  to view this content.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Summing From a Date to a Desired Cell Value

    Here's an non-VBA way of doing it. You could probably roll this all up into one function, but I left it as helper cells so the logic is more clear.

    Cell E1 has the date of interest.

    Cell E2 has the formula =MATCH(E1,A:A,0) - this formula finds the first row on which the date occurs.

    Cell E3 has the formula =MATCH(0,OFFSET(B1,E2,0,1000,1),0) - this gets a bit more complicated. First we'll look at the range. This is provided by the offset part.

    OFFSET(B1,E2,0,1000,1) This says, starting at cell B1 go down the number of rows indicated in cell E2, go over zero columns and then give me a range 1000 rows deep and 1 column wide.

    That's what we apply the match to. We are looking for the first zero in this range and it happens 6 rows below the specified date and that is your answer.
    Attached Files Attached Files
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  4. #4
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Summing From a Date to a Desired Cell Value

    =sum(offset(b1:b24,match(i3,a1:a24,0)-1,,match(0,offset(b1:b24,match(i3,a1:a24,0)-1,,rows(b1:b24)-match(i3,a1:a24,0)+1),0),))
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  5. #5
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Summing From a Date to a Desired Cell Value

    =MATCH(0,INDEX(B1:B24,MATCH(I3,A1:A24,0)):B24,0)-1
    if there is only 1s and 0s then the above will work

  6. #6
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Summing From a Date to a Desired Cell Value

    Inspired by nflsales's excellent solution ... suppose the ranges are unknown.

    =MATCH(0,INDEX(B:B,MATCH(I3,A:A,1)):INDEX(B:B,MATCH(1E+306,A:A,1)),0)-1
    Dave

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1