+ Reply to Thread
Results 1 to 9 of 9

Problems with INDEX, MATCH

  1. #1
    Registered User
    Join Date
    02-16-2015
    Location
    Hamburg, Germany
    MS-Off Ver
    2010
    Posts
    5

    Problems with INDEX, MATCH

    Hey! I have a table similar to the strongly eased down version seen below:

    ------Column 1----Column 2---Column 3----Column 4
    A-----123 -------------------------------------------
    B-----234 -------------------------------------------
    C-----345 -------------------------------------------
    A-------------------121-----------------------------
    B----------------------------------------------------
    C-------------------141-----------------------------
    A-----------------------------------------------------
    B-------------------------------242-----------------
    C-------------------------------252----------------
    A-------------------------------------------919
    B-------------------------------------------818
    C-------------------------------------------717

    I want that table to look like this:

    ------Column 1----Column 2---Column 3----Column 4
    A------123----------121--------------------- 919
    B------234-----------------------242---------818
    C------345----------141---------252---------717

    conditions are as follows:
    - A, B, C are not always in the same order and don't appear in similar numbers
    - Not every letter has a value in every column, as hinted in the example
    - The table contains 500.000 rows - and 36 columns. That means that I'm in dire need for an automatic solution via formulars or macros

    My problem: my excel-knowledge is too limited for that problem. I tried INDEX, MATCH but that failed because excel would always just look for the first "A". column 2 automatically gets a "0" for that reason. That makes my table look like that:

    ------Column 1----Column 2---Column 3----Column 4
    A------123----------0------------0-------------0
    B------234----------0------------0-------------0
    C------345----------0------------0-------------0


    A guess would be, that the solution lies in usage of "LARGE", but that is beyond my understanding
    Or would a VBA-Macro be the way?

    Help would just be so incredible great!!
    Thanks a lot in advance!

  2. #2
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,723

    Re: Problems with INDEX, MATCH

    Here is a pivot table solution. It will take care of the 500 000 rows automatically, however the 36 columns will have to be handled individually. The columns are dragged to the values window and the field setting is changed from count to sum. You'll need to enable editing to see the field list.
    Here is a file containing a mock up of the data in post #1 with a PT applied: Pivot Table Arrangement.xlsx
    Let me know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  3. #3
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Problems with INDEX, MATCH

    Hi

    Use the following formula
    =IFERROR(INDEX(A$1:A$9999,AGGREGATE(15,6,1/(1/(ROW($A$1:$A$999)*(A$1:A$9999<>""))),ROW($A1:$A9999)),1),"")
    and copy down and right
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  4. #4
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: Problems with INDEX, MATCH

    uploaded file with a view of a solution will be greatly appritiated

  5. #5
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,660

    Re: Problems with INDEX, MATCH

    If there is not more than one value of A,B,C and all are numeric values, then you could use SUMIF for that.
    Assuming layout shown (data in B2:E13, headers in row1 and column A) in C2 formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    and copy right down

    to show empty cells instead of zeros, you may use:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Best Regards,

    Kaper

  6. #6
    Registered User
    Join Date
    02-16-2015
    Location
    Hamburg, Germany
    MS-Off Ver
    2010
    Posts
    5

    Re: Problems with INDEX, MATCH

    Quote Originally Posted by JeteMc View Post
    Here is a pivot table solution. It will take care of the 500 000 rows automatically, however the 36 columns will have to be handled individually. The columns are dragged to the values window and the field setting is changed from count to sum. You'll need to enable editing to see the field list.
    Here is a file containing a mock up of the data in post #1 with a PT applied: Attachment 451279
    Let me know if you have any questions.
    O my.. that was easier than expected. Thanks a lot, that helped me a ton! You single handedly saved my day Sir!


    Quote Originally Posted by José Augusto View Post
    Hi

    Use the following formula
    =IFERROR(INDEX(A$1:A$9999,AGGREGATE(15,6,1/(1/(ROW($A$1:$A$999)*(A$1:A$9999<>""))),ROW($A1:$A9999)),1),"")
    and copy down and right
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    That looks like magic! I litteraly have not a single clue what you did there, thanks a lot for you effort!
    The formula works to some extend, but has problems with empty rows from what I tried. I would dive deeper and change stuff back and forth, but the solution JeteMc provided was what I needed, so there is no necessity. Thanks again anyway, highly, highly appreciated!

  7. #7
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Problems with INDEX, MATCH

    Just to throw one more solution in there....
    Using Jose's file, in Cells A18:E20,, In B18 copied right, I put this regular formula

    =IFERROR(INDEX(B$2:B$13,MATCH($A18,INDEX($A$2:$A$13,MATCH(1,INDEX(1/ISNUMBER(B$2:B$13),),0)):INDEX($A$2:$A$13,MATCH(9000,B$2:B$13)),0)+MATCH(1,INDEX(1/ISNUMBER(B$2:B$13),),0)-1),"")
    Attached Files Attached Files
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  8. #8
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,723

    Re: Problems with INDEX, MATCH

    Quote Originally Posted by The Excel Noob View Post
    O my.. that was easier than expected. Thanks a lot, that helped me a ton!
    You're Welcome and thank you for the feedback. If you haven't already, please take a moment to mark the thread 'Solved' using the thread tools link above your first post. I hope that you have a good day.

  9. #9
    Registered User
    Join Date
    02-16-2015
    Location
    Hamburg, Germany
    MS-Off Ver
    2010
    Posts
    5

    Re: Problems with INDEX, MATCH

    Quote Originally Posted by JeteMc View Post
    You're Welcome and thank you for the feedback. If you haven't already, please take a moment to mark the thread 'Solved' using the thread tools link above your first post. I hope that you have a good day.
    Done. You too!

+ 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 Problems
    By n3mcx1 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-14-2015, 11:44 AM
  2. Problems applying INDEX-MATCH-MATCH function on other data
    By LennartB in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-13-2015, 05:33 AM
  3. Replies: 6
    Last Post: 04-30-2014, 02:42 AM
  4. problems with index/match
    By FFFran in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-13-2013, 01:29 PM
  5. Index Match Problems
    By markd87 in forum Excel General
    Replies: 1
    Last Post: 07-22-2011, 11:32 AM
  6. Various index match problems
    By Joe Pineapples in forum Excel General
    Replies: 3
    Last Post: 05-03-2009, 06:47 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