+ Reply to Thread
Results 1 to 3 of 3

Sum values going back N days ago

Hybrid View

Buzzed Aldrin Sum values going back N days... 11-04-2013, 07:55 PM
martindwilson Re: Sum values going back N... 11-04-2013, 08:11 PM
Buzzed Aldrin Re: Sum values going back N... 11-05-2013, 01:33 PM
  1. #1
    Registered User
    Join Date
    02-04-2012
    Location
    CA, USA
    MS-Off Ver
    Excel 2010
    Posts
    56

    Sum values going back N days ago

    Given a column of ordered dates (note that some dates are missing or duplicated) and corresponding values like this:

    10/18/2013 6
    10/19/2013 8
    10/21/2013
    10/22/2013
    10/23/2013
    10/25/2013 8
    10/25/2013 5
    10/25/2013
    10/28/2013
    10/28/2013
    10/28/2013 6
    10/28/2013
    10/28/2013 8
    10/28/2013
    10/28/2013
    10/30/2013 4
    10/31/2013
    10/31/2013

    I want to sum all values in the righthand column going back N days ago (inclusive or exclusive doesn't matter, whichever is simplest).

    For example, today is 11/4/2013, so if N were 10, the summation would start at 10/26/2013, and the calculated value would be 18 (6+8+4).
    Note that 10/26/2013 is missing -- If the calculated starting date doesn't exist, then start at the next most recent date (10/28/2013 in this case).

    TIA for any help!

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Sum values going back N days ago

    =SUMPRODUCT(--(A1:A30<=E1),--(A1:A30>=E1-9),B1:B30) wher e1 has todays date
    or
    =SUMPRODUCT(--(A1:A30<=today()),--(A1:A30>=today()-d1),B1:B30) where d1 holds the value N
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Registered User
    Join Date
    02-04-2012
    Location
    CA, USA
    MS-Off Ver
    Excel 2010
    Posts
    56

    Re: Sum values going back N days ago

    Perfect! Thanks so much martin, especially for the 2 versions, both work exactly as desired.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 04-22-2013, 01:47 AM
  2. [SOLVED] Counting days back from a date
    By blkirby in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-20-2012, 07:24 PM
  3. Date minus 2 days back
    By mjshort88 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-06-2011, 02:15 PM
  4. Breakdown Months-to-Days-Hours & Back?
    By mycon73 in forum Excel General
    Replies: 4
    Last Post: 02-26-2011, 12:55 AM
  5. Add figures 60 days back
    By janger in forum Excel General
    Replies: 9
    Last Post: 08-23-2010, 09:15 AM

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