+ Reply to Thread
Results 1 to 4 of 4

Need formula to return a specific value if a specified date is between two other dates

  1. #1
    Forum Contributor BeachRock's Avatar
    Join Date
    11-01-2011
    Location
    Oregon, United States
    MS-Off Ver
    Excel 2016
    Posts
    403

    Need formula to return a specific value if a specified date is between two other dates

    Hello,

    I'm trying to write a formula that will look at one reference date, compare it to two named ranges of dates and then return a number that represents the row where the first date is between the other two. Please see the attached example workbook for a better visual explanation.

    For example: I have two sheets, one is named "Lists" and contains 3 dynamic named ranges; Lists_BudgetNum - in Column A is a numerical value representing the start and end dates of the row it is on, Lists_BudgetStart - in Column B represents all of the start dates for each budget year, and Lists_BudgetEnd - Column C represents all of the end dates for each budget.

    The other sheet is named Transactions and contains the date field (G3) that I want to find to be in between the Lists_BudgetStart and Lists_BudgetEnd ranges. Cell J3 on the Transaction sheet is where the formula will be and where I want to return the budget number associated with the Budget Start and Budget End dates that the reference date in G3 falls between.

    If Transactions!J3 date value is 10/11/2013, the Lists_BudgetNum returned should be "3". I think the formula should use INDEX MATCH and COUNTIFS but I haven't been at all successful using it so I tried using an IF statement instead of COUNTIFS which returns "1" no matter what the reference date is currently.... That's what you will see in the example file right now.


    Thanks,
    -------------
    Tony

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,459

    Re: Need formula to return a specific value if a specified date is between two other dates

    If budgetNum is alway number, try:
    =SUMPRODUCT((Lists_BudgetStart<=$G3)*(Lists_BudgetEnd>=$G3)*Lists_BudgetNum)
    IF it is text, try with INDEX.
    Quang PT

  3. #3
    Forum Contributor BeachRock's Avatar
    Join Date
    11-01-2011
    Location
    Oregon, United States
    MS-Off Ver
    Excel 2016
    Posts
    403

    Re: Need formula to return a specific value if a specified date is between two other dates

    Quang, if I could buy you a beer for this, I surely would! That works perfectly. Thank you!

  4. #4
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,459

    Re: Need formula to return a specific value if a specified date is between two other dates

    Thank for feedback and for the rept!

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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. [SOLVED] Looking for formula to return a date that falls between 2 dates
    By cobo1981 in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 03-13-2014, 01:12 PM
  2. Replies: 2
    Last Post: 12-31-2012, 12:47 PM
  3. formula to return date specific criteria
    By n1kk1 in forum Excel General
    Replies: 6
    Last Post: 01-17-2012, 03:28 PM
  4. Date Function formula that will return the date of a specific week
    By Greg in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-12-2006, 12:10 PM
  5. formula to look up and return smallest date from a range of dates
    By BJ in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-07-2005, 06:40 PM

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