+ Reply to Thread
Results 1 to 10 of 10

help with formula to add values up if cell falls within a date range

  1. #1
    Registered User
    Join Date
    02-01-2015
    Location
    USA
    MS-Off Ver
    14.4.7
    Posts
    10

    help with formula to add values up if cell falls within a date range

    Hello,

    I've exhausted my Excel knowledge. What I'm trying to do is take the values of particular cells and add them together if another cell (in the same row) falls between certain dates. For example:

    Cell A1 has the start date (1/1/15) and B1 has the end date (12/31/15)
    Cell D1 is where the formula would be that adds up the total
    Cell A4 has date 6/10/15 and B4 has the value of 5
    Cell A5 has date 1/15/16 and B6 has the value of 7
    Cell A6 has date 7/13/15 and B5 has the value of 3
    Cell A7 has date 1/20/16 and B7 has the value of 2

    What I'm trying to get cell D1 to do is add the cells B4 through B7 together if the cells A4 through A7 fall between the dates of cells A1 and B1.

    So, if the dates are 1/1/15 - 12/31/15, the value of D1 would automatically equal 8. And if I changed the year from 15 to 16, D1 would equal 9.

    The spreadsheet that I am working with has hundreds of values, rows, etc., but the example above would greatly help me if someone has any thoughts.

    Thanks!

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

    Re: help with formula to add values up if cell falls within a date range

    What version of Excel are you using?
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    02-01-2015
    Location
    USA
    MS-Off Ver
    14.4.7
    Posts
    10

    Re: help with formula to add values up if cell falls within a date range

    I'm using the 2010 version from Office Standard. I also like to export these to Google Docs spreadsheet feature, if that makes any difference.

  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: help with formula to add values up if cell falls within a date range

    Here's the Excel formula...

    =SUMIFS(B4:B7,A4:A7,">="&A1,A4:A7,"<="&B1)

    Don't know if that's portable with Google spreadsheets or not.

  5. #5
    Registered User
    Join Date
    02-01-2015
    Location
    USA
    MS-Off Ver
    14.4.7
    Posts
    10

    Re: help with formula to add values up if cell falls within a date range

    Thanks. My total cell (D1) comes up with 0. But oddly enough as an experiment, if I changed the dates to numerical values and went about it that way, it works for the range. Do you know of another way to invoke it to read the range of dates? I've tried all sorts of date formatting too (i.e. 1/10/15, 01/10/15, 01/10/2015, etc

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

    Re: help with formula to add values up if cell falls within a date range

    Sounds like your dates really aren't dates!

    In Excel dates are really just numbers formatted to look like dates. These numbers are commonly referred to as the date serial number. The date serial number is the count of days starting from a base date. In Windows Excel the default base date is January 1, 1900. So, January 1, 1900 is date serial number 1.

    Jan 1 1900 = date serial number 1
    Jan 2 1900 = date serial number 2
    Jan 3 1900 = date serial number 3
    Jan 4 1900 = date serial number 4
    Jan 5 1900 = date serial number 5
    etc
    etc
    Jan 1 1975 = date serial number 27395
    Jan 1 2000 = date serial number 36526
    Jan 1 2014 = date serial number 41640

    You can see the date serial number by entering some date in a cell and then changing that cells format to General or Number.

    So, if a cell, say A1, contains a true Excel date then:

    =ISNUMBER(A1) will return TRUE

  7. #7
    Registered User
    Join Date
    02-01-2015
    Location
    USA
    MS-Off Ver
    14.4.7
    Posts
    10

    Re: help with formula to add values up if cell falls within a date range

    I added them as dates (used the Format cell approach to select the date). Is there anything that I'm missing that is making the cell appear as a non-date?

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

    Re: help with formula to add values up if cell falls within a date range

    I would have to see the file if possible.

    I can't download "gigantic" files so it would have to be a SMALL file.

  9. #9
    Registered User
    Join Date
    02-01-2015
    Location
    USA
    MS-Off Ver
    14.4.7
    Posts
    10

    Re: help with formula to add values up if cell falls within a date range

    so, I tried it with Excel 2013 and it works per your formula. I suppose there is something wiry with 2010? Anyone, I greatly appreciate your help and the follow through assistance!

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

    Re: help with formula to add values up if cell falls within a date range

    Good deal. Thanks for the feedback!

+ 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: 7
    Last Post: 07-14-2017, 12:04 PM
  2. Returning different values if cell falls between a certain date range
    By mlstutesman in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-23-2015, 12:11 PM
  3. [SOLVED] Formula to assign specific numbers if a date falls within a certain date range
    By headley4ever in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-24-2014, 04:16 PM
  4. [SOLVED] Return cell value if date falls within specified range
    By coza in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-10-2013, 03:58 PM
  5. Replies: 15
    Last Post: 04-08-2013, 12:40 PM
  6. Mark cell if location matches and date falls between date range
    By DoodlesMama in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-24-2012, 07:54 PM
  7. Replies: 4
    Last Post: 02-18-2009, 09:21 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