+ Reply to Thread
Results 1 to 7 of 7

Possible to make a UDF for the INDEX MATCH combo function?

  1. #1
    Registered User
    Join Date
    06-18-2015
    Location
    Arizona
    MS-Off Ver
    2013
    Posts
    3

    Possible to make a UDF for the INDEX MATCH combo function?

    There have been several articles written by various authors regarding the advantages of using the INDEX/MATCH formula over the related VLOOKUP function. However, probably the biggest obstacle that exists for those interested in just making an absolution switch over to INDEX/MATCH (including myself) is the complexity of the function needed using both INDEX and MATCH and the lack of the same intuitive variable usage in the required INDEX/MATCH functions that exists in VLOOKUP, which gets me to my request.

    Q: Does there exist, or can VBA code be written, that would make a new UDF that simplifies the use of the INDEX/MATCH function?

    I keep this little two line cheat summary nearby for using INDEX/MATCH, including the MSDN reference when needed:

    =INDEX ( Column I want a return value from , MATCH ( My Lookup Value , Column I want to Lookup against , Enter “0” ))

    Additional use of this: https://msdn.microsoft.com/en-us/lib...ffice.14).aspx

    My suggestion would be to create a UDF, say “INMATCH” (INdex MATCH) that would work like this:

    INMATCH (lookup value, column value from, column lookup against, [match type, default = “0” is exact match])

    Adding this to your personal VBA project modules for global usage on a user’s PC would be killer!!

    Really looking for some feedback/help. Thanks!!!

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Possible to make a UDF for the INDEX MATCH combo function?

    Welcome to the board.

    It's certainly doable, but then every workbook needs to be macro-enabled, which is a problem in many environments.

    After you write INDEX/MATCH formulas a few dozen times, you can do them in your sleep.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    06-18-2015
    Location
    Arizona
    MS-Off Ver
    2013
    Posts
    3

    Re: Possible to make a UDF for the INDEX MATCH combo function?

    I have previously tried, but was unsuccessful in creating the UDF.

    Do you think you could quickly create a working INDEX/MATCH UDF?

    Thanks!!

  4. #4
    Registered User
    Join Date
    06-18-2015
    Location
    Arizona
    MS-Off Ver
    2013
    Posts
    3

    Re: Possible to make a UDF for the INDEX MATCH combo function?

    I appreciate the feedback, but writing is the UDF is the solution I'm looking for.

    Do you have the ability to take an initial attempt to write it? as I mentioned, I have not been successful. Thanks.

  5. #5
    Registered User
    Join Date
    10-12-2015
    Location
    Bristol, UK
    MS-Off Ver
    Office 365
    Posts
    39

    Re: Possible to make a UDF for the INDEX MATCH combo function?

    As a start...

    Please Login or Register  to view this content.
    This could do with further development to tighten up input parameters, output etc. Others here may have suggestions on using alternatives to the WorksheetFunctions, which I suspect aren't that fast.

    It would also need to be included in an AddIn workbook, rather than Personal.xlsb, if it is to be used in other workbooks.

    If performance is an issue, then an in-cell INDEX+MATCH would be quicker (this UDF took twice as long as INDEX+MATCH on a 200k row sample set).

  6. #6
    Forum Contributor
    Join Date
    12-24-2014
    Location
    little ole England
    MS-Off Ver
    2013
    Posts
    116

    Re: Possible to make a UDF for the INDEX MATCH combo function?

    hiya i had similar request a short while ago i posted on different forum here is link

    https://www.mrexcel.com/forum/excel-...f-lookups.html

    the UDF we arrived at with most flexibilty was ( note there are couple of associated functions lower in code )

    i suspect as highlighted above this will be slower than an actual index/match formula but it is easy to understand and create one if a few seconds are not important

    Please Login or Register  to view this content.

    it is easier to read the associated post linked than for me to explain again
    ◄Ŧя?μвŁ?►
    By Name & By Nature

  7. #7
    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,942

    Re: Possible to make a UDF for the INDEX MATCH combo function?

    Perhaps this will help you to undersstand a bit better?
    INDEX returns a value at the intersect (meeting) of a row and a column.
    INDEX() syntax is =INDEX(range,row-num,column-num)
    so something like =INDEX(A1:J10,3,5)
    will return the contents of E3 (row 3, column 5)
    Didnt even use MATCH, did we?

    Now, to find the "3" or the "5", we would use the MATCH function...
    MATCH syntax is...=match(criteria-to-find,column-to-search-in,0) 0 returns exact match
    =MATCH("cc",A1"A10,0)
    If "cc" is in A3, this will return 3
    (to find the column number, we use the same thing, just change the range=MATCH(criteria-to-find,row-to-search-in,0)
    '=MATCH("zz",A1:J1,0)
    If "zz" is in E1, then this will return 5

    Put them all together and you have...
    =INDEX(A1:J10,MATCH("cc",A1:A10,0),MATCH("zz",A1:J10))
    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

+ 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. Index, Match, If / And, Combo Box used in Conjunction??
    By childs71 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-07-2015, 08:35 AM
  2. Replies: 0
    Last Post: 07-26-2015, 09:14 PM
  3. [SOLVED] Make an index and match function dynamic
    By concatch in forum Excel General
    Replies: 3
    Last Post: 08-18-2014, 02:35 PM
  4. Three Way Lookup Using Index Match Combo
    By nathanhamilton82 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-07-2012, 03:39 PM
  5. Replies: 2
    Last Post: 11-05-2011, 03:26 PM
  6. Lookup, Index, Match ... Not sure which combo will do it?
    By nikko4239 in forum Excel General
    Replies: 4
    Last Post: 06-08-2010, 06:32 PM
  7. [SOLVED] Emulate Index/Match combo function w/ VBA custom function
    By Spencer Hutton in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-02-2005, 01:06 PM

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