+ Reply to Thread
Results 1 to 5 of 5

Formula to pick a date between 2 selected dates in order to add numbers together.

  1. #1
    Registered User
    Join Date
    11-06-2009
    Location
    St. Louis, MO
    MS-Off Ver
    Excel 2007
    Posts
    4

    Formula to pick a date between 2 selected dates in order to add numbers together.

    I am trying to create a formula that will basically look at a date that i have in a cell determine wether or not it is in between 2 other dates that i have in 2 other cells and if so add a number that i have in a different cell. If none of the dates are in between the 2 dates I want it to display message.

    Ok so that might be very confusing so Im going to give you an example...
    A B
    1] 10/10/2009 $500
    2] 10/20/2009 $600
    3] 10/23/2009 $400
    4]
    5] 10/15/2009 10/25/2009
    6]
    7] Desired output here in A7


    In this case It should say $1000 but i want it to display a message saying like No Data or something if there wasnt anything in that date window i created.

    Any help will be appreciated.

    O and im using office 2007
    Last edited by Quiltface; 11-06-2009 at 10:30 AM. Reason: My title wasnt clear enough.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Formula to pick a date between 2 selected dates in order to add numbers together.

    Given your use of XL2007 I would be inclined to use

    A7: =SUMIFS($B$1:$B$4,$A$1:$A$4,">="&$A$5,$A$1:$A$4,"<="&$B$5)

    Then apply a custom format to cell A7 (ie via CTRL + 1) of: #,##0.00;[red](#,##0.00);"No Data"
    (alter number formats to suit)

    The above format: positive; negative format; zero format will ensure that 0 is displayed and printed as No Data but the underlying value persists as 0.

  3. #3
    Registered User
    Join Date
    11-06-2009
    Location
    St. Louis, MO
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Formula to pick a date between 2 selected dates in order to add numbers together.

    You da man.

    Is there a way this could work with 2003?

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Formula to pick a date between 2 selected dates in order to add numbers together.

    Pre2007, SUMPRODUCT is generally the adopted approach

    =SUMPRODUCT(--($A$1:$A$4>=$A$5),--($A$1:$A$4<=$B$5),$B$1:$B$4)

    this will work in 2007 also but if you're running exclusively in 2007 environment the SUMIFS approach would be deemed preferable in terms of efficiency etc...

  5. #5
    Registered User
    Join Date
    11-06-2009
    Location
    St. Louis, MO
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Formula to pick a date between 2 selected dates in order to add numbers together.

    Very nice, thank you very much.

+ 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