+ Reply to Thread
Results 1 to 8 of 8

Formula to check if a date falls within a date range, then returns a corresponding cell

  1. #1
    Registered User
    Join Date
    06-26-2012
    Location
    Chicago
    MS-Off Ver
    Excel 2011
    Posts
    6

    Formula to check if a date falls within a date range, then returns a corresponding cell

    Hello,

    I am trying to create a formula that will take a selected date, check to see which date range it falls in, and then have it return a cell that is the corresponding id number to the range. So for the file that I have attached, I want to take a specific date in the column "Date" check to see which range it falls in between the Start Date and End Date, and then have the ID that is associated with the date range put into column F, next to column E.
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    06-19-2012
    Location
    N/A
    MS-Off Ver
    Excel 2007
    Posts
    46

    Re: Formula to check if a date falls within a date range, then returns a corresponding cel

    Enter the following in F2 and drag it down:

    Please Login or Register  to view this content.
    Hope this helps.
    If I have helped, please click the star below.

  3. #3
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,902

    Re: Formula to check if a date falls within a date range, then returns a corresponding cel

    Try:

    =INDEX($A$2:$A$3,MATCH(1,INDEX(($B$2:$B$3<=E2)*(C2:C3>=E2),0),0))

    copied down
    Last edited by NBVC; 06-26-2012 at 03:22 PM.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  4. #4
    Registered User
    Join Date
    06-26-2012
    Location
    Chicago
    MS-Off Ver
    Excel 2011
    Posts
    6

    Re: Formula to check if a date falls within a date range, then returns a corresponding cel

    Thanks for the help. How would I change the formula so that it works if I have more date ranges and ID's to check. I posted an attachment of what it would look like.
    Attached Files Attached Files

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,902

    Re: Formula to check if a date falls within a date range, then returns a corresponding cel

    Use formula:

    =INDEX($A$2:$A$9,MATCH(1,INDEX(($B$2:$B$9<=E2)*($C$2:$C$9>=E2),0),0))

    copied down... and expand ranges as needed.

  6. #6
    Registered User
    Join Date
    06-26-2012
    Location
    Chicago
    MS-Off Ver
    Excel 2011
    Posts
    6

    Re: Formula to check if a date falls within a date range, then returns a corresponding cel

    Works great. Thanks a lot

  7. #7
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,902

    Re: Formula to check if a date falls within a date range, then returns a corresponding cel

    You are welcome.

    Please mark your thread as SOLVED

  8. #8
    Registered User
    Join Date
    07-14-2017
    Location
    New York
    MS-Off Ver
    365
    Posts
    4

    Re: Formula to check if a date falls within a date range, then returns a corresponding cel

    I'm also learning the index and match functions.
    I'm trying to build a formula that searches expenses by date and returns the sum of values only during that month.
    This way I can have an endless expenses sheet and my monthly P&L searches for expenses that only occurred during that month.
    I have attached sample data. This same formula could ultimately be used for income too.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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