+ Reply to Thread
Results 1 to 7 of 7

Formula to sum cells within date range.

  1. #1
    Registered User
    Join Date
    01-22-2013
    Location
    Pittsburgh
    MS-Off Ver
    Excel 2003
    Posts
    6

    Formula to sum cells within date range.

    Good morning! This is my first post here and I am hoping to get some help with a formula that has me stumped. Usually I am pretty good with searching the web for help with Excel but I can't seem to find what I need for this one.

    Here is a summary of what I am looking for. Let's say I have the following grid of data:

    Date Numeric Value
    12/1/2012 3
    6/5/2012 2
    1/23/2012 2
    1/1/2012 5

    I am looking for a formula that will sum the values in "Numeric Value" only if the date falls somewhere between the current date minus 12 months (or 365 days, whichever is easier). So assuming today's date is 1/22/2013, I would want to see a result of 7. However, come the end of this week, I would want the result to be 5 because the 1/23/2012 date should now fall outside of that range.

    It is worth mentioning that this grid will expand over time as new lines are added. I am open to creating a number of blank rows to populate later if that is necessary.

    I greatly appreciate any help that you can offer. Please let me know if I need to clarify anything further.

  2. #2
    Valued Forum Contributor Melvinrobb's Avatar
    Join Date
    06-19-2012
    Location
    Manitoba, Canada
    MS-Off Ver
    Excel 2013
    Posts
    1,128

    Re: Formula to sum cells within date range.

    Assuming your table starts in A1, the following should work:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Please click the * icon below if I have helped.

  3. #3
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Formula to sum cells within date range.

    hi jxpresto, welcome to the forum. try:
    =SUMPRODUCT((A2:A5>=TODAY()-365)*(A2:A5<=TODAY()),B2:B5)

    or:
    =SUMPRODUCT((A2:A5>=TODAY()-DATE(YEAR(A2)-1,MONTH(A2),DAY(A2)))*(A2:A5<=TODAY()),B2:B5)

    you can expand the range if you are expecting more data

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Formula to sum cells within date range.

    Try this...

    =SUMPRODUCT(--(A2:A100>=TODAY()-365),--(A2:A100<=TODAY()),B2:B100)

    Let's go Pens!
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Formula to sum cells within date range.

    =sumproduct((a1:a10>=today()-365)*(b1:b10))
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  6. #6
    Registered User
    Join Date
    01-22-2013
    Location
    Pittsburgh
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Formula to sum cells within date range.

    Wow thank you all for the prompt replies, the suggestions worked perfectly.

  7. #7
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,361

    Re: Formula to sum cells within date range.

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as "SOLVED".

    How?
    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

    Note:
    You can also thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given.
    By doing so you can add to the reputation(s) of those who helped and shared their time in helping you.
    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

+ 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