+ Reply to Thread
Results 1 to 3 of 3

Lookup function

  1. #1
    Registered User
    Join Date
    10-20-2010
    Location
    Chicago, Illinois
    MS-Off Ver
    Excel 2007
    Posts
    69

    Lookup function

    Hi,

    I have three columns... column A contains identifiers, column B contains dates associated with identifiers in column A, column C contains dates i have entered.

    What i want to do is for excel to give me in column D the identifier in column A whose date in column B matches closest to the date i have entered in column C.

    please see the attached excel sheet...

    For example,

    A B C D

    912828ES5 1/15/2047 5/15/2038 912828FH8
    912828JY7 1/31/2050 10/1/2035 9128276T4
    9128276T4 9/15/2035 2/15/2047 912828ES5
    912828KE9 1/28/2039 2/15/2050 912828JY7
    912828EX4 9/28/2039 2/15/2041 912828FA3
    912828KH2 9/31/2020 4/1/2030 912828FD7
    912828FA3 3/31/2041 10/1/2039 912828EX4
    912828KL3 9/30/2047 1/1/2039 912828KE9
    912828FD7 4/30/2030 11/15/2020 912828KH2
    912828FH8 5/31/2038 11/1/2047 912828KL3



    i've tried using the LOOKUP function in excel, but it doesn't always give me the correct identifier whose date matches closest to the date i have entered in column C.

    is there another way to accomplish this that will give me the correct result?

    thanks
    Attached Files Attached Files

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Lookup function

    Using your posted workbook.

    If I understand you correctly, you want each formula to return the Col_A value associated with the Col_B date that is closest to the Col_C reference date AND that Col_B date may be greater than or less than the Col_C date.

    If that's true, this regular formula returns the same values that you listed in your posted workbook.
    Please Login or Register  to view this content.

    Copy that formula down through D10.

    In the posted example, those formula return these values in D1:D10
    Please Login or Register  to view this content.

    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Registered User
    Join Date
    10-20-2010
    Location
    Chicago, Illinois
    MS-Off Ver
    Excel 2007
    Posts
    69

    Re: Lookup function

    thanks Ron!

    i think this is going to work.

+ 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