+ Reply to Thread
Results 1 to 15 of 15

Index Function to search from a range

  1. #1
    Valued Forum Contributor
    Join Date
    01-02-2004
    Location
    malaysia
    Posts
    342

    Index Function to search from a range

    Hi,
    I humbly seek help and tips to get my Index Function fine tuned as it does not return correctly. I have two sheets, Sheet1 consists of Company Name and Person In charge. Sheet2 is a full list detailing specific person in charge in a specific company. I need sheet1 Column B to be updated automatically when Column A is entered. Attached is the file for your easy understanding. Any help is greatly appreciated.
    Attached Files Attached Files

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: Index Function to search from a range

    is there a specific reason sheet2 is laid out the way it is? it would be far easier to find what you need if it was laid out more along the lines of what you have on sheet1?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Valued Forum Contributor
    Join Date
    01-02-2004
    Location
    malaysia
    Posts
    342

    Re: Index Function to search from a range

    Hi,
    The file was originally created by my friend and I am asked to update it in Sheet1. Is vlookup and index function can accomplish the task? Thanks in advance.

  4. #4
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Index Function to search from a range

    Quote Originally Posted by FDibbins View Post
    is there a specific reason sheet2 is laid out the way it is? it would be far easier to find what you need if it was laid out more along the lines of what you have on sheet1?
    As FDibbins said, i think that can not get the results as your data in sheet 2, are in this laid out.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  5. #5
    Valued Forum Contributor
    Join Date
    01-02-2004
    Location
    malaysia
    Posts
    342

    Re: Index Function to search from a range

    Besides Index and Vlookup, is there any other function that can get my results?

  6. #6
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Index Function to search from a range

    My opinion, is NO.

    You have to change the way that your data exist in your second sheet.

  7. #7
    Valued Forum Contributor
    Join Date
    01-02-2004
    Location
    malaysia
    Posts
    342

    Re: Index Function to search from a range

    Hi Fotis1991,
    Thanks for your confirmation.

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Index Function to search from a range

    Obviously there's a limit to 7 of these for Excel 2003, but this would work:

    B2:
    =IF(ISNUMBER(MATCH(A2, Sheet2!$2:$2, 0)), HLOOKUP(A2, Sheet2!$2:$3, 2, 0),
    IF(ISNUMBER(MATCH(A2, Sheet2!$5:$5, 0)), HLOOKUP(A2, Sheet2!$5:$6, 2, 0),
    IF(ISNUMBER(MATCH(A2, Sheet2!$8:$8, 0)), HLOOKUP(A2, Sheet2!$8:$9, 2, 0))))



    Since the workbook has macros in it already, we could create a custom function to do this, too. More plumbing...
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  9. #9
    Valued Forum Contributor
    Join Date
    01-02-2004
    Location
    malaysia
    Posts
    342

    Re: Index Function to search from a range

    Hi JBeaucaire,
    I will give it a try,thanks a lot.

  10. #10
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Index Function to search from a range

    If that takes care of your original query, please select Thread Tools from the menu above and mark the thread as solved. Thanks.

  11. #11
    Valued Forum Contributor
    Join Date
    01-02-2004
    Location
    malaysia
    Posts
    342

    Re: Index Function to search from a range

    Hi JBeaucaire,
    If my company name in Sheet2 is very long, will the function work? Thank you.

  12. #12
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Index Function to search from a range

    Why wouldn't it? What happened when you tried it?

  13. #13
    Valued Forum Contributor
    Join Date
    01-02-2004
    Location
    malaysia
    Posts
    342

    Re: Index Function to search from a range

    It is still workable until 5 of these in B2

    =IF(ISNUMBER(MATCH(A21, Sheet2!$2:$2, 0)), HLOOKUP(A21, Sheet2!$2:$3, 2, 0),
    IF(ISNUMBER(MATCH(A21, Sheet2!$5:$5, 0)), HLOOKUP(A21, Sheet2!$5:$6, 2, 0),
    IF(ISNUMBER(MATCH(A21, Sheet2!$8:$8, 0)), HLOOKUP(A21, Sheet2!$8:$9, 2, 0),
    IF(ISNUMBER(MATCH(A21, Sheet2!$11:$11, 0)), HLOOKUP(A21, Sheet2!$11:$12, 2, 0),
    IF(ISNUMBER(MATCH(A21, Sheet2!$14:$14, 0)), HLOOKUP(A21, Sheet2!$14:$15, 2, 0))))))


    can it go more?
    Last edited by seanyeap; 10-22-2012 at 10:13 AM.

  14. #14
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Index Function to search from a range

    Quote Originally Posted by JBeaucaire View Post
    Obviously there's a limit to 7 of these for Excel 2003...
    Yes, looks like you can do two more.

  15. #15
    Valued Forum Contributor
    Join Date
    01-02-2004
    Location
    malaysia
    Posts
    342

    Re: Index Function to search from a range

    After 2 more, it will be the end? I have huge rows in the sheet, can I ask for a Custom Function? Thank you.

+ 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