+ Reply to Thread
Results 1 to 3 of 3

Index Match VBA

  1. #1
    Registered User
    Join Date
    06-24-2015
    Location
    Oklahoma City
    MS-Off Ver
    2016
    Posts
    28

    Index Match VBA

    Hi, I am trying to use a formula array in vba but am getting a run-time error("Unable to set the FormulaArray property of the Range Class").
    I am trying to insert an index match formula and carry it down.
    The line of code giving the error is the following.
    Please Login or Register  to view this content.
    oFormatLastRow is a variable for the total number of rows in my worksheet "Original Format". This list in which I am looking up values is on a different sheet named "Deduct Codes"

    Question1: Why is the code not working as it is?

    Question2: Is there a way to write this using variables instead of row numbers? I ask because my list in "Deduct Codes" could grow and I don't want to have to come back and change this line every time it does. My attempt at this is the following but it was not successful either and gave the same error as above. In the following "dCodesLastRow" is a variable for the total number of rows in the worksheet "Deduct Codes"
    Please Login or Register  to view this content.
    Any help is appreciated,
    Thanks

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Index Match VBA

    Q1:

    There could be more than one problem but this stuck out at me right away. Your formula includes the following use of the MATCH function:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    The second argument to MATCH must be an array. You are concatenating two values, which will result in a value, not an array. (The array processing will interpret it as an array, but MATCH won't.)

    It is difficult to diagnose this kind of thing without a description of what you are trying to get your code to do, all of your code, and it's even better to have your file.

    Q2:

    If you solve the problem causing the error, this second version looks like it will work fine.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    06-24-2015
    Location
    Oklahoma City
    MS-Off Ver
    2016
    Posts
    28

    Re: Index Match VBA

    Thank you for the reply. The problem was I was using ".FormulaArray" when it needed to be ".Formula" instead. The 2nd attempt worked as well with the previously mentioned fix.
    Thanks Again!

+ 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. [SOLVED] INDEX+MATCH instead of VLOOKUP+MATCH, why is INDEX a better choice and how to re-write?
    By Renejorgensen in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-23-2016, 10:54 AM
  2. [SOLVED] Index / Match - match 3 input values and return the results from the index
    By t83357 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-08-2016, 07:34 PM
  3. [SOLVED] Match-Index in stead of Index-Match lookup Array among Arrays
    By Numnum in forum Excel General
    Replies: 2
    Last Post: 10-15-2015, 02:08 PM
  4. INDEX MATCH MATCH/OFFSET MATCH MATCH with named ranges
    By Andrew-Mark in forum Excel General
    Replies: 3
    Last Post: 02-27-2015, 10:56 PM
  5. Replies: 6
    Last Post: 04-30-2014, 02:42 AM
  6. Replies: 6
    Last Post: 11-08-2013, 10:29 PM
  7. Replies: 3
    Last Post: 05-02-2013, 01:31 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