+ Reply to Thread
Results 1 to 5 of 5

Search a column to return values just above and below the search criteria

  1. #1
    Registered User
    Join Date
    12-20-2012
    Location
    Northeast Ohio
    MS-Off Ver
    Excel 2010
    Posts
    3

    Search a column to return values just above and below the search criteria

    Okay...so here goes my first post:

    I have a search I'd like to do on a table of data. I have an ascending list of numbers, non repeating and each unique. I'd like to search the first column to look for one of those values, and give me the prior and next value in the table. Or even better, return to me the associated data of the prior and next row in the last column. I do not want to have the original search value returned to me.

    It's been a long day >.<

    I included a sheet with some values to show what I'm working with. I'd like to search column A, for say '774.87536752463', and only have returned to me 'Indigo' and Kilo'. Most of what I can find via searching and reading will return only 'Juliet'.

    MultReturn.xlsx
    Last edited by Rehpot; 12-20-2012 at 05:30 PM. Reason: added attachment & hopefully clarification

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Search a column to return values just above and below the search criteria

    Rehpot,

    Welcome to the forum!
    Attached is a modified version of your posted workbook.
    The cell where you type in the unique number is H2

    In cell H3 is this formula to get the data from column E (Prior):
    Please Login or Register  to view this content.

    In cell H4 is this formula to get the data from column E (Next):
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    12-20-2012
    Location
    Northeast Ohio
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Search a column to return values just above and below the search criteria

    Glad to be here! I'll help where I can. Sometimes I start projects that end up over my head though

    That...was stunningly fast!

    "starred" you

  4. #4
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Search a column to return values just above and below the search criteria

    You're very welcome and thank you for the star tap

    If that takes care of your need, please mark this thread as solved.
    How to mark a thread Solved
    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word "Title" you will see a dropdown with the words "No prefix"
    Change to "Solved"
    Click Save

  5. #5
    Registered User
    Join Date
    12-20-2012
    Location
    Northeast Ohio
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Search a column to return values just above and below the search criteria

    Must the search array be in ascending order? I realized after i got your modified code to return the unique numbers, that I should have the table sorted by a different column first.

    I wonder if I should just post the actual workbook in it's entirety?

    Edit:

    So I answered my own question (love that)! I simply tried what I was thinking. I reordered the column I should have the first time, and the search seems to be going off without a hitch.

    Thanks again! Now, off to mark the thread solved.
    Last edited by Rehpot; 12-21-2012 at 10:52 AM.

+ 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