+ Reply to Thread
Results 1 to 20 of 20

How to filter quickly 2 mutidimensional array?

  1. #1
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    How to filter quickly 2 mutidimensional array?

    Hi Guys,

    i have table:

    Topo Value
    H1 1
    H1 2
    H1 3
    H2 4
    H2 5
    H2 6
    H3 7
    H3 8

    and what i want to do to get quickly filter from arrayTable without looping if it possible.

    The 1 dim array can be filtered like here:

    Please Login or Register  to view this content.
    But i am getting error when trying to filter 2 dimensional array. It is possible to do this without loop?

    Best,
    Jacek
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: How to filter quickly 2 mutidimensional array?

    I think I posted similar code before...
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: How to filter quickly 2 mutidimensional array?

    thank you!

    Jacek

  4. #4
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: How to filter quickly 2 mutidimensional array?

    jindon,

    one more thing,
    if i want to take more than 1 or more columns into array how should i modify the code?

    Topo Value Value2
    H1 1 a
    H1 2 b
    H1 3 c
    H2 4 d
    H2 5 e
    H2 6 f
    H3 7 g
    H3 8 h

    Thank you,
    Jacek

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: How to filter quickly 2 mutidimensional array?

    It should automatically do it according to the number of columns in the list object.

  6. #6
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: How to filter quickly 2 mutidimensional array?

    Oh right,

    thank you!

    Jacek

  7. #7
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: How to filter quickly 2 mutidimensional array?

    Ok problem solved

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: How to filter quickly 2 mutidimensional array?

    Please Login or Register  to view this content.
    Extract parts from an array using Index method, 2nd arg needs to be 2d array and 3rd should be 1d array.
    Evaluate("transpose(row(1:" & .Columns.Count & "))" creates {1,2,3} when columns.count = 3
    You can also change the order when you need to
    e.g
    Please Login or Register  to view this content.
    reverse order

  9. #9
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: How to filter quickly 2 mutidimensional array?

    thank you very much for your explanation, great code!

    Jacek

  10. #10
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: How to filter quickly 2 mutidimensional array?

    Hi Guys,

    i have one more question.

    I would like to add second column to my table as condition.

    So if range = H2 and range = 4, how can i filter?
    So i would like totake only these 2 rows:

    H2 4 a
    H2 4 b

    Please help,

    Best,
    Jacek
    Attached Files Attached Files

  11. #11
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: How to filter quickly 2 mutidimensional array?

    Please try

    Please Login or Register  to view this content.

  12. #12
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: How to filter quickly 2 mutidimensional array?

    That's a question of how to create an array for the condition of 2nd argument in Index method.

    Like ordinary If function in worksheet + means Or, * means And

    If((A1="X")*(B1="Y"),True,False)
    A1="X" 1 when true, 0 when false
    B1 ="Y" 1 when true, 0 when false

    So it evaluates 0 as False, other than 0 as True.
    1 + 0, 0 + 1 both true in Or condition
    1*1 is the only True in And condition

  13. #13
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: How to filter quickly 2 mutidimensional array?

    O wow thank you Guys!!

    It is solved and understood!
    Best,
    Jacek

  14. #14
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: How to filter quickly 2 mutidimensional array?

    Ok i found one more issue.

    When you do not have active tab --> function is not working for me. I mean x is empty.
    Hmm i do not know if i can use this method because i am refering to hidden sheet.

    Best,
    Jacek

  15. #15
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: How to filter quickly 2 mutidimensional array?

    You need qualify the Evaluate method like range

    Please Login or Register  to view this content.

  16. #16
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: How to filter quickly 2 mutidimensional array?

    oo wow.
    How this is working and why this is working ?

    Best,
    Jacek

  17. #17
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: How to filter quickly 2 mutidimensional array?

    Evalueate method has 2 types
    Applucation and worjsheet.
    Worksheet.evaluate is the fastest.
    Application.evaluate assumes the cell referene in active sheet.

    From phone.

  18. #18
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: How to filter quickly 2 mutidimensional array?

    Thank you.

    jindon so this parent enforces to get application.evaluate because worksheet fails?

    Best,
    Jacek

  19. #19
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: How to filter quickly 2 mutidimensional array?

    Parent in this case refers to Sheet1.
    So, equivalent to
    Sheets("Sheet1").evaluate
    So that all the address in formula refers to
    Sheet1!A1:A10 etc.

  20. #20
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: How to filter quickly 2 mutidimensional array?

    ok great!

    So we are using fastest evaluate

    Thank you,
    Best,
    Jacek

+ 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 and Filter Functions: Workaround to sort, filter, and format within array?
    By beginner21 in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 04-25-2021, 04:48 PM
  2. Google Sheets - Quickly go to a record based on the result of filter formula
    By mariannehislop in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 0
    Last Post: 04-10-2021, 04:43 AM
  3. Replies: 4
    Last Post: 12-09-2020, 01:06 PM
  4. Replies: 0
    Last Post: 08-09-2019, 05:00 AM
  5. [SOLVED] Using array to quickly loop through data
    By mongoose36 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-08-2014, 11:42 AM
  6. Moving dictionary items to an 2D array that can be placed into worksheet quickly
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-22-2014, 01:21 PM
  7. Replies: 1
    Last Post: 01-07-2014, 08:59 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