+ Reply to Thread
Results 1 to 10 of 10

Macro for INDEX and MATCH

  1. #1
    Registered User
    Join Date
    03-16-2012
    Location
    Russia
    MS-Off Ver
    Excel 2010
    Posts
    98

    Macro for INDEX and MATCH

    index.xlsb

    Here is example file. Help pls with VBA code against formula. Because file may include more than 250K rows for sheet1 and the same for sheet2. So, formula works very slowly.

    Also, very often the case that I need to compare the filtered bands and stretch the formula in the filtered range. Stretching the formula in the filtered band is very difficult, if he has a lot of rows. Therefore, if the table that we are looking for and from which the copy has filters - and it also needs to look only in the filtered range.

    Often it is necessary to compare the way different ranges, would be very happy if the macro will be able to specify the range of the pop-up window. I would appreciate it if someone decides to help.

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro for INDEX and MATCH

    Where do the new entries get made - on both sheet1 and sheet2 or just on sheet2? The problem is that I don't understand what you require
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    03-16-2012
    Location
    Russia
    MS-Off Ver
    Excel 2010
    Posts
    98

    Re: Macro for INDEX and MATCH

    I can not attach the original table, therefore, put an example.

    The first and second tables may be different (it can be anything). But they always have a shared column (it has a partial or full match) by which to make comparisons.

    All that is required is to replace the formula of a function or macro. To be able to search for data from the first table in the second range and pull the desired value.

    Therefore, I ask to help with the universal macro for any table with proposal selection ranges and output. For a range or a single column (see formula in example).

    At present, a few problems:
    1. Formula for a long time working on large data (250k+ rows)
    2. The table of the first sheet may be set filter. And needs to compare visible values on the filter with the second sheet (which may also be a filter). It is necessary to compare both the filtered and unfiltered ranges only visible values);
    3. 3. In large data uncomfortable stretching formula in the filtered range.
    Last edited by Remphan; 01-16-2016 at 02:59 PM.

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro for INDEX and MATCH

    Hi Remphan,

    I guess I'm a little slow - but, it seems that you haven't answered my question

  5. #5
    Registered User
    Join Date
    03-16-2012
    Location
    Russia
    MS-Off Ver
    Excel 2010
    Posts
    98

    Re: Macro for INDEX and MATCH

    Quote Originally Posted by xladept View Post
    Hi Remphan,

    I guess I'm a little slow - but, it seems that you haven't answered my question
    H3:H69 formula and J3:M69. New entries only in this range (in that case) in first sheet for first table.

    The 1st page table is which we are looking for value from 2nd.
    2nd sheet table - from where we copy the values into 1st sheet for 1st table.

    That is, the real situation is always the same, there are two tables (different tables with shared column [partial or full match] or identical tables) on different pages, and they should be compared. From the second table we need pull up values to the second value.

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro for INDEX and MATCH

    So, with a change on the second we must update the first sheet? I'm thinking of event code

  7. #7
    Registered User
    Join Date
    03-16-2012
    Location
    Russia
    MS-Off Ver
    Excel 2010
    Posts
    98

    Re: Macro for INDEX and MATCH

    Quote Originally Posted by xladept View Post
    So, with a change on the second we must update the first sheet? I'm thinking of event code
    Sometimes* is a one-time action. Then I copy/paste the values (obtained by the formula) without format.
    Copy formula result and paste the values in the case of filtered range - uncomfortable. So needs remove the filter from all over the sheet, and copy and paste the values without format the entire column or a range.

    The second table may be located in another book. Just for the convenience of using a formula that does not get lost in the many my workbooks I copy a second table from another workbook in the second sheet current book. After receiving the data by the formula and paste data as a value - delete the second sheet.

    It is not difficult to do. The issue was initially that the formula works for a long time if the book contains a lot of rows and columns (macro or vba function will be faster). And that uncomfortable stretching formula on filter case. That is, if the range has a filter, then compare only the visible region and inserted into the visible range results.

    *But sometimes it is required and automatic recalculation. That is sometimes the second table on the second sheet and leave to automatically recalculate.
    Last edited by Remphan; 01-17-2016 at 06:54 AM.

  8. #8
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro for INDEX and MATCH

    Hi Remphan,

    I've submitted this thread to the community of experts as I just don't know what you need. You may be getting questions from some other experts now

  9. #9
    Registered User
    Join Date
    03-16-2012
    Location
    Russia
    MS-Off Ver
    Excel 2010
    Posts
    98

    Re: Macro for INDEX and MATCH

    Quote Originally Posted by xladept View Post
    Hi Remphan,

    I've submitted this thread to the community of experts as I just don't know what you need. You may be getting questions from some other experts now
    Ok. Just what I needs is change formula H3:H69 and J3:M69 by function or macro. If the vba function - that I will can stretch it into cells where it is needed. In case of macro - each time it will be difficult to frequently change the code (a lot of different tables, and books for comparison), so I would like him to ask - which ranges compare and where you want to insert data.

    In short, just ask a vba function to replace the current formulas in example at my 1st post (for column only like H3:H69 or range like J3:M69) if someone has the opportunity to do it. Because vba will run faster than formula at 250-500k rows
    Last edited by Remphan; 01-17-2016 at 12:24 PM.

  10. #10
    Registered User
    Join Date
    03-16-2012
    Location
    Russia
    MS-Off Ver
    Excel 2010
    Posts
    98

    Re: Macro for INDEX and MATCH

    If anybody can help - help, pls.
    Cross for issue
    Last edited by Remphan; 01-18-2016 at 09:45 AM.

+ 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] 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
  2. Replies: 6
    Last Post: 04-30-2014, 02:42 AM
  3. Replies: 6
    Last Post: 11-08-2013, 10:29 PM
  4. Replies: 3
    Last Post: 05-02-2013, 01:31 AM
  5. Macro or Index/Match?
    By ytrehguodleinad in forum Excel General
    Replies: 2
    Last Post: 06-06-2012, 11:00 PM
  6. [SOLVED] INDEX / MATCH or do I need a Macro?
    By reece in forum Excel General
    Replies: 7
    Last Post: 05-10-2012, 09:00 PM
  7. macro for index, match
    By psrs0810 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-02-2010, 05:30 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