+ Reply to Thread
Results 1 to 2 of 2

User defined MATCH-INDEX function in VBA

  1. #1
    Registered User
    Join Date
    03-02-2016
    Location
    London
    MS-Off Ver
    2010
    Posts
    1

    User defined MATCH-INDEX function in VBA

    Hi all,

    It is my first time trying to create a user defined function from scratch (previously just copied from internet when needed) but haven't been able to crack this.

    The idea is to have a user defined function for each match lookup rather than having the entire formula each time which can get messy if multiple arguments are going to be used.

    So for the below formula, the user defined INDEX-MATCH function would be named after the MATCH field e.g. CodeType

    =IF($B2=C$1,INDEX(Raw!$B:$U,ROW(),MATCH("CodeType",Raw!$B$1:$U$1,0)),"")
    becomes
    =IF($B2=C$1,CodeType(),"")

    Likewise, for:
    =IF($B2=I$1,INDEX(Raw!$B:$U,ROW(),MATCH("Description",Raw!$B$1:$U$1,0)),"")
    becomes
    =IF($B2=C$1,Description(),"")

    So INDEX(Raw!$B:$U,ROW(),MATCH("XYZ",Raw!$B$1:$U$1,0)) would be XYZ()

    I appreciate any and all help, and let me know if you need further clarification.

    Thanks

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: User defined MATCH-INDEX function in VBA

    I'm a bit late to the party since I've been on vacation. I hope you have this issue solved by now.

    If you could provide a sample worksheet with the data scrubbed to protect sensitive information, it would help a lot. I'm not sure what you are trying to do and it might be possible that VBA will not be required. At any rate Index / Match don't exist in VBA. You'll have to use .Find and .Offset to get the same results.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

+ 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. Replies: 1
    Last Post: 07-19-2014, 06:29 AM
  2. [SOLVED] INDEX MATCH MATCH gives N/A without row numbers defined
    By cbearl78 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-01-2013, 05:18 PM
  3. [SOLVED] Defined Name + Index Match
    By ricky2k2 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-04-2012, 10:47 AM
  4. How to write user defined function for Index and Match
    By spybug in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-24-2012, 05:20 AM
  5. Creating a deeply nested IF MATCH user defined function
    By rrbest in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-26-2011, 01:23 PM
  6. User Defined Function using Sumifs, Offset, Match and CountA
    By PeterW2020 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-29-2011, 02:29 AM
  7. Replies: 4
    Last Post: 03-04-2010, 11:53 AM

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