+ Reply to Thread
Results 1 to 4 of 4

Invalid Index Match function Issue

  1. #1
    Registered User
    Join Date
    08-12-2015
    Location
    Brisbane,Aus
    MS-Off Ver
    2013
    Posts
    4

    Invalid Index Match function Issue

    Hi

    I'm developing a spreadsheet in order to analyse a range of collected data. I want the cell to show the thickness data for when a specific date and ID criteria have been matched. I got the first range of points to work using this formula:

    =INDEX(Sheet4!$H$2:$H$4569,MATCH(C$2,Sheet4!$G$2:$G$4569,0),MATCH($A3,Sheet4!$E$2:$E$4569,0))

    but when I dragged the formula to the second row of different ID #REF appeared and I am unable to work out what is wrong with the formula. Attached is a screen capture of the second row attempt and formula of the second row.


    Any help would be greatly welcomed. Thanks

    Capture.JPG

  2. #2
    Valued Forum Contributor quekbc's Avatar
    Join Date
    01-18-2010
    Location
    Sydney, Australia
    MS-Off Ver
    2010, 2013, 2016
    Posts
    1,149

    Re: Invalid Index Match function Issue

    The second MATCH function seems to be throwing things off. The INDEX reference is a single column reference in column H. The first MATCH function determines which row to look at, which should work fine, but the second MATCH function looks at which column. Any result above 1 (since its a single column INDEX reference) will create a #REF! error.

    Without a sample of your workbook I can't be too sure, but try this.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  3. #3
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    365 Version 2409
    Posts
    2,789

    Re: Invalid Index Match function Issue

    Index needs a row number and a column number.
    You are referencing a single column, so you would only return a row number, but you have two match functions. The column number should be either omitted or set to 1. If your second match function doesn't return 1 you are probably going to get an error.

  4. #4
    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
    53,048

    Re: Invalid Index Match function Issue

    Hi, welcome to the forum

    Looking at your formula...
    =INDEX(Sheet4!$H$2:$H$4569,MATCH(C$2,Sheet4!$G$2:$G$4569,0),MATCH($A3,Sheet4!$E$2:$E$4569,0))
    You have a few things out of place there

    To explain how INDEX/MATCH/MATCH works...
    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))

    So, back to your formula...
    =INDEX(Sheet4!$H$2:$H$4569,MATCH(C$2,Sheet4!$G$2:$G$4569,0),MATCH($A3,Sheet4!$E$2:$E$4569,0))
    your INDEX range Sheet4!$H$2:$H$4569 needs to either cover all the rows AND columns in your data - and then use 2 MATCH's - or just use 1 column and 1 match
    Your 2nd MATCH - IF it is needed, needs to reference a range of columns, not a range or rows

    So, perrhaps your formula should be...
    =INDEX(Sheet4!$E$2:$H$4569,MATCH(C$2,Sheet4!$G$2:$G$4569,0),MATCH($A3,Sheet4!$E$2:$H$2,0))

    If that still doesnt work, upload a small (clean) sample workbook (not a pic) of what you are working with, and what your expected outcome would look like.
    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. [SOLVED] Receiving an Invalid qualifier error with the .Match function
    By ForNoRaisin in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-28-2015, 04:33 PM
  2. Issue: Only returning 1st match on Index/Match
    By tbr2891 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-21-2014, 11:54 AM
  3. [SOLVED] Match Issue - Consolidate Columns of Data With Match/Index/etc?
    By excelsior123 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-03-2014, 05:14 PM
  4. Issue with using Index Match function to return value from Summary Sheet
    By missmea2005 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-01-2013, 02:02 PM
  5. Runtime Error '5': Invalid procedure. . . using Match worksheet function.
    By eli.rhodes in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-02-2012, 12:01 PM
  6. index match issue
    By jw01 in forum Excel General
    Replies: 1
    Last Post: 07-13-2012, 11:02 PM
  7. Replies: 4
    Last Post: 04-02-2012, 01:19 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