+ Reply to Thread
Results 1 to 8 of 8

Sum Specific Range in Dynamic Excel File

Hybrid View

  1. #1
    Registered User
    Join Date
    06-28-2007
    Posts
    63

    Sum Specific Range in Dynamic Excel File

    I have a data file that has news rows added to it every day. I want to be able to sum the seven rows of data automatically, so only the last seven days of data are used in my calculations. Is this possible?

    Also, I have another data sheet that has multiple enteries per day. Is it possible to only sum the last 7 days of data. There are more than seven rows of data but only for seven days. Thanks for the help.

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Sum Specific Range in Dynamic Excel File

    If we knew the structure of your data, that would help us understand your issue. Can you describe the data...or, even better...post a zipped Excel file with sample data? (Hopefully, there's a date column that we could use for criteria.)
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Registered User
    Join Date
    06-28-2007
    Posts
    63
    An outline of the data structure:

    Column A:|Column B:
    Date1| Number 1
    Date2| Number 2

    There are new days with corresponding numbers added each day. Each entry adds a new row. I want sum the numbers corresponding to the last seven days.

  4. #4
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582
    Last Seven days or last 7 data points (or are they always synonymous)?

    ChemistB

  5. #5
    Registered User
    Join Date
    06-28-2007
    Posts
    63
    They are always synonymous. Except one data sheet has more rows than days. So there could be 10 rows of data for 7 days, but I want to sum the last seven days, not exactly the last seven rows.

  6. #6
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    EDITED: Sum Specific Range in Dynamic Excel File

    Let's see if I understand what you want.....

    With
    A2:A50 will hold dates, initially only A2 and other dates will be added below.
    B2:B50 will hold amounts corresponding to the entered dates

    This formula sums the Col_B values for
    the last date entered in Col_A
    AND
    the previous six days:
    C1: =SUMIF(A2:A50,">="&(LOOKUP(10^99,A2:A50)-6),B2:B50)
    so....
    If A35 contains 28-JUL-2008 AND is the last date at the bottom of the list,
    that formula will sum the amounts from 22-JUL-2008 through 28-JUL-2008
    (a 7 day range)

    Note: That 7-day range could be more than 7 rows if any dates have more than one entry.

    EDITED TO INCLUDE THE FOLLOWING:
    If the Col_A dates will ALWAYS be in ascending order...
    this formula returns the sum of values for the
    dates Max_Date through Max_Date_Minus_6
    C1: =SUMIF(A:A,">="&MAX(A:A)-6,B:B)
    Is that something you can work with?
    Last edited by Ron Coderre; 07-29-2008 at 08:14 PM.

+ 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