+ Reply to Thread
Results 1 to 12 of 12

Thread: Creating a VBA function to combine INDEX and MATCH

  1. #1
    Registered User
    Join Date
    02-01-2011
    Location
    London, England
    MS-Off Ver
    Office 2007 Standard
    Posts
    11

    Question Creating a VBA function to combine INDEX and MATCH

    I hardly ever use VLOOKUP anymore in favour of INDEX(MATCH) but I can never get the order of all the arguments right!

    So I want to create a VBA function that combines the two of them - a kind of SuperVLOOKUP that lets you search leftwards and/or start from beyond the first column, with the following arguments:
    1. Source data range
    2. Index
    3. Column within source data range containing index value
    4. Column within source data range containing return value
    But I haven't got the foggiest idea how to start - in particular how to pass arguments that could be values, or ranges, or whatever, and values that could be in any format.

    Can anyone suggest a starting point - or even better, share a function they've already written to do the job?

    Thank you

  2. #2
    Forum Guru
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Excel 2010
    Posts
    1,502

    Re: Creating a VBA function to combine INDEX and MATCH

    I'm bumping this because I, too, would benefit from this. Anybody want to tackle it?

  3. #3
    Forum Guru
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Excel 2010
    Posts
    1,502

    Re: Creating a VBA function to combine INDEX and MATCH

    I'm still interested in a solution. Anyone have insight on this?

  4. #4
    Forum Guru
    Join Date
    10-28-2008
    Location
    Not here anymore
    MS-Off Ver
    irrelevant
    Posts
    10,151

    Re: Creating a VBA function to combine INDEX and MATCH

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread.

  5. #5
    Forum Guru
    Join Date
    10-28-2008
    Location
    Not here anymore
    MS-Off Ver
    irrelevant
    Posts
    10,151

    Re: Creating a VBA function to combine INDEX and MATCH

    Other than that, it's really not all that hard to remember the syntax of Index/Match.

    Put up a Post-it on your monitor

    Index(Range,match(find row), match(find column))

    Using VBA to re-invent the wheel will not be more efficient.

  6. #6
    Forum Guru
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Excel 2010
    Posts
    1,502

    Re: Creating a VBA function to combine INDEX and MATCH

    I'm not cross posting; I'm interested in the answer to the original OPs question, which no one has responded to. No cross purpose here, no other agenda.

  7. #7
    Forum Guru
    Join Date
    10-28-2008
    Location
    Not here anymore
    MS-Off Ver
    irrelevant
    Posts
    10,151

    Re: Creating a VBA function to combine INDEX and MATCH

    No, you're not cross posting. You're hi-jacking. That's a different thing. Read the forum rules. It's all explained in there.

  8. #8
    Forum Guru
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Excel 2010
    Posts
    1,502

    Re: Creating a VBA function to combine INDEX and MATCH

    Hi-Jacking means to steer it away from it's original destination, which is not what I did. I'm encouraging it to follow on to it's intended destination. It's like the car stalled in the middle of the street, so I'm calling folks to help push it to it's destination.

  9. #9
    Forum Guru snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,151

    Re: Creating a VBA function to combine INDEX and MATCH

    Alt-F11/F2/Index/Enter/worksheetfunction



  10. #10
    Forum Guru
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Excel 2010
    Posts
    1,502

    Re: Creating a VBA function to combine INDEX and MATCH

    SNB,
    AltF11, and F2 I follow. F2 opens the Object Browser, which I've never used, so don't know where to put in INDEX.

  11. #11
    Forum Guru snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,151

    Re: Creating a VBA function to combine INDEX and MATCH

    In the only spot you can put in characters in the object browser.



  12. #12
    Forum Guru
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Excel 2010
    Posts
    1,502

    Re: Creating a VBA function to combine INDEX and MATCH

    And then I assume I go to "Worksheet Function" in the "Classes" section?

+ 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.2.0