+ Reply to Thread
Results 1 to 8 of 8

Index Function Error

  1. #1
    Registered User
    Join Date
    08-14-2015
    Location
    UK
    MS-Off Ver
    2013
    Posts
    10

    Index Function Error

    I'm trying to pull data from a multiple spreadsheets into one and the below formula has worked for all of the spreadsheets apart from 1 where it just returns an error. I can't see any formatting differences on this workbook compared to the others and the file name is correct. If anyone has any idea why this is happening or if they can suggest how it can be fixed I would be externally grateful.

    {=IFERROR(INDEX([TEST.xls]BZ!$AD$2:$AD$1009,SMALL(IF($O$1=[TEST.xls]BZ!$D$2:$D$1009,ROW([TEST.xls]BZ!$D$2:$D$1009)-ROW([TEST.xls]BZ!$D$2)+1),ROW(1:1))),"0")}

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,216

    Re: Index Function Error

    change to ...

    =IFERROR(INDEX([TEST.xls]BZ!$AD$2:$AD$1009,SMALL(IF($O$1=[TEST.xls]BZ!$D$2:$D$1009,ROW([TEST.xls]BZ!$D$2:$D$1009)-ROW([TEST.xls]BZ!$D$2)+1),ROWS($1:1))),"0")

    ROWS($1:1) not ROW(1:1)

  3. #3
    Registered User
    Join Date
    08-14-2015
    Location
    UK
    MS-Off Ver
    2013
    Posts
    10

    Re: Index Function Error

    I tried your suggestion but no joy. I don't think the formula is wrong as it does work for others so I think there is something different with the work book its accessing for this row (each row in the workbook has this formula but with a different file name, (each row represents a month)) as it works for other files.

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,216

    Re: Index Function Error

    It worked when I created "Test.xls" with worksheet "BZ". What results are you getting?

  5. #5
    Registered User
    Join Date
    08-14-2015
    Location
    UK
    MS-Off Ver
    2013
    Posts
    10

    Re: Index Function Error

    I'm getting the IFERROR function so 0. When I remove the IFERROR Function from the Formula I get #NUM! as a result.

  6. #6
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,216

    Re: Index Function Error

    Probably comparing text with numbers (or similar mismatch of data types). O1 vs Column D ?

  7. #7
    Registered User
    Join Date
    08-14-2015
    Location
    UK
    MS-Off Ver
    2013
    Posts
    10

    Re: Index Function Error

    I have managed to solve it although i'm not sure what the issues was. When I evaluated the Formula it wasn't able to locate O1 in Column D. Cell O1 was in a table and when I copied the data and pasted it outside of the table (I moved it to cell E23) so now it was looking for cell E23 in column D and it worked. I couldn't see an differences in the formatting of column D in any of the other spreadsheets but I guess there must have been at some level.

    Any way all sorted thanks for your help it's much appreciated

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Index Function Error

    Quote Originally Posted by johnmahon12 View Post
    =IFERROR(INDEX([TEST.xls]BZ!$AD$2:$AD$1009,SMALL(IF($O$1=[TEST.xls]BZ!$D$2:$D$1009,ROW([TEST.xls]BZ!$D$2:$D$1009)-ROW([TEST.xls]BZ!$D$2)+1),ROW(1:1))),"0")
    Some tips...

    If you index the entire column:

    =IFERROR(INDEX([TEST.xls]BZ!$AD:$AD...

    Then you can eliminate the "offset correction" :

    -ROW([TEST.xls]BZ!$D$2)+1

    So the formula becomes:

    =IFERROR(INDEX([TEST.xls]BZ!$AD:$AD,SMALL(IF($O$1=[TEST.xls]BZ!$D$2:$D$1009,ROW([TEST.xls]BZ!$D$2:$D$1009)),ROW(1:1))),"0")

    ROW(1:1) should be replaced with the ROWS( ) function and the cell address should be that of the first cell the formula is entered in. For example, if the first formula is entered in cell D2 then use:

    ROWS(D$2:D2)

    Using the ROWS( ) function makes the formula more robust and accounts for new row insertions before the referenced range which could lead to incorrect results.

    So the formula becomes:

    =IFERROR(INDEX([TEST.xls]BZ!$AD:$AD,SMALL(IF($O$1=[TEST.xls]BZ!$D$2:$D$1009,ROW([TEST.xls]BZ!$D$2:$D$1009)),ROWS(D$2:D2))),"0")

    In formulas, do not quote numbers:

    "0"

    Quoting numbers turns them into TEXT values. This could cause problems in any downstream calculations.

    In most functions "0" and 0 are not the same. "0" is text while 0 is numeric.

    So the formula becomes:

    =IFERROR(INDEX([TEST.xls]BZ!$AD:$AD,SMALL(IF($O$1=[TEST.xls]BZ!$D$2:$D$1009,ROW([TEST.xls]BZ!$D$2:$D$1009)),ROWS(D$2:D2))),0)

    All formulas are still array entered!
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

+ 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: 5
    Last Post: 01-30-2015, 06:39 PM
  2. [SOLVED] Index Match Function Within One Workbook Referencing Cells in Another workbook error
    By Hackboss007 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-18-2014, 12:06 PM
  3. index function error using match function to get data from a cell in an array
    By mabildgaard in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-17-2013, 02:21 AM
  4. Error in index match function
    By joshnvince in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-12-2013, 02:12 AM
  5. [SOLVED] Trying to use INDEX function in VBA Code, compile error
    By Finny in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 07-26-2006, 02:20 PM
  6. Index function error
    By Motty in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-04-2005, 02:12 PM
  7. [SOLVED] Error Return Value from and INDEX(A:2,MATCH()) function
    By BJ in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-26-2005, 11:06 AM

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