+ Reply to Thread
Results 1 to 6 of 6

Find a date within a date range and return the header

  1. #1
    Forum Contributor
    Join Date
    08-22-2013
    Location
    US
    MS-Off Ver
    Mac Version 2011
    Posts
    126

    Find a date within a date range and return the header

    Hi guys,

    I'm looking to match a date to a date range and then return the respective header of that date range.

    Please look at the attached file.

    Thanks!
    Attached Files Attached Files

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Find a date within a date range and return the header

    I went with this:

    =INDEX(A1:A13,SUMPRODUCT((B2:B13<=E3)*(C2:C13>=E3)*(ROW(A2:A13))))
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  3. #3
    Forum Contributor
    Join Date
    11-15-2012
    Location
    Buffalo, NY
    MS-Off Ver
    Office 365
    Posts
    286

    Re: Find a date within a date range and return the header

    I wonder if it's just coincidence that the place where you entered the 'test date' was the same row that matched your range? You don't say if you have any VBA coding experience or not, so it's hard to know exactly how to help you (as opposed to doing your work for you )

    You might want to try something along the lines of:
    Please Login or Register  to view this content.
    OTOH, if that makes as much sense as a recipe written in Urdu, then you probably need to get some reading done.

    The problem you are facing is:
    Please Login or Register  to view this content.
    It's a simple while loop, and shouldn't take too long to figure out. However, if you are a newbie to coding, you'd be better off doing some reading first!

    HTH

    Tony

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,720

    Re: Find a date within a date range and return the header

    This array* formula in F3:

    =IFERROR(INDEX($A$2:$A$13,MIN(IF((E3>=$B$2:$B$13)*(E3<=$C$2:$C$13),ROW($B$2:$B$13)-1))),"")

    seems to do the trick.

    *Use Ctrl-Shift-Enter to commit an array formula, rather than the usual <Enter>.

    Hope this helps.

    Pete

  5. #5
    Forum Contributor
    Join Date
    08-22-2013
    Location
    US
    MS-Off Ver
    Mac Version 2011
    Posts
    126

    Re: Find a date within a date range and return the header

    daffodil11's formula works well.

    Pete_UK: Your formula when used on larger population is not correct in some cases. Thank you so much, though, for the formula. I appreciate it.

  6. #6
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Find a date within a date range and return the header

    Awesome, I did good stuff. Thanks for feedback.

    Mom will be so proud.

+ 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] Find first date of the month in range and return column number
    By jben86 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-06-2013, 08:30 PM
  2. Search date range +/- 7 days and return date that falls within range
    By tlafferty in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-13-2013, 03:26 PM
  3. [SOLVED] Create Fiscal Year - Lookup Date in Fiscal Month Date Range and Return EOM Date
    By gbriscoe in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-25-2013, 03:29 PM
  4. Replies: 2
    Last Post: 01-04-2012, 09:15 AM
  5. Find last numerical value in row range and return the column header
    By Fidd$ in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 03-04-2011, 10:15 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