+ Reply to Thread
Results 1 to 19 of 19

The fastest way to find specific values within table

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

    The fastest way to find specific values within table

    Hi,

    i have source table like this (TOPO1 and TOPO3 are inoutted variables which can be changed)

    Screenshot_8.png

    and i want to loop through table and output result like here (based on Input Values)

    Screenshot_9.png

    What is the fastest way to do this?

    Best,
    Jacek
    Attached Files Attached Files

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,890

    Re: The fastest way to find specific values within table

    You have already set to Filter the table, click on the drop down and unclick those items you don't wish to see.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: The fastest way to find specific values within table

    Why do you want to use VBA

    Just enter Topology in G1

    Select your table and use a Data Advanced Filter, Filter in Place and specify G1:G3 as the criteria.

    If you want the details output to another area then enter the two column labels somewhere and instead of Filter in Place choose the Copy to another location and select the two column labels.

    See attached
    Attached Files Attached Files
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

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

    Re: The fastest way to find specific values within table

    Hi,

    than you very much.

    i have output result into separate worksheet.

    So advanced filter it is the best option in VBA also ?Can you help with code?

    This is only part of macro so i have to use VBA here.

    Please help,
    Jacek

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,890

    Re: The fastest way to find specific values within table

    Use the macro recorder to do what you want, then post your code here and explain what needs to modified in the code.

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

    Re: The fastest way to find specific values within table

    Hi alansidman,

    I do not want to use macro recorder - it is not the best solution and not good approach.

    Goal is clear. The output range should be copied from table.
    And question also is clear - what is the best option to do this?

    Use advance filter in VBA?

    Best,
    Jacek

  7. #7
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,890

    Re: The fastest way to find specific values within table

    Will the input values always be in G2 and G3? Will it be more than two? How to handle if less than two or more than two. Need to know specifics. That is why I asked that you use the Macro recorder and then we would adapt it. Since you don't wish to help in that manner, then need to know specifics. Be as detailed as possible as you are aware, VBA is not generic.

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

    Re: The fastest way to find specific values within table

    ok, i understand, thank you.

    Will the input values always be in G2 and G3? Will it be more than two?
    Yes, input values will be in column G, you can have the list of filtered values there, it can be 1 and more.

    So generally - you have the list which will be the base for getting listrows from table and copied into second worksheet.

    Best Wishes,
    Jacek

  9. #9
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,890

    Re: The fastest way to find specific values within table

    Here is a VBA solution for you.

    Please Login or Register  to view this content.
    Change up the paste range as needed.

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

    Re: The fastest way to find specific values within table

    Thank you very much,

    seems to be interesting approach.
    What do you say to use dictionary and listrows?

    Best,
    Jacek

  11. #11
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,890

    Re: The fastest way to find specific values within table

    Please Login or Register  to view this content.
    Not familiar. But if it works for you, then in the words of NIKE, "Just Do It."

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

    Re: The fastest way to find specific values within table

    Thank you very much.

    Ok your method if i will have thousends of rows can be slow because you are copying bunch of specific rows.

    Do you think advance filter will be faster?

    Jacek

  13. #13
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,890

    Re: The fastest way to find specific values within table

    Test it and make a determination. I think filtering is always faster, but try out both and see.

    Link to multi filter VBA-->https://trumpexcel.com/vba-autofilter/
    Last edited by alansidman; 05-18-2019 at 03:12 PM.

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

    Re: The fastest way to find specific values within table

    thank you very much.

    Best,
    Jacek

  15. #15
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: The fastest way to find specific values within table

    OK, VBA AdvancedFilter.
    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

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

    Re: The fastest way to find specific values within table

    thank you bakerman2,

    Please Login or Register  to view this content.
    can i provide criteria not in range but in memory?

    I mean create range criteria on the fly directly in a code and not refer to worksheets cells?

    Jacek

  17. #17
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: The fastest way to find specific values within table

    I haven't seen it done yet.

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

    Re: The fastest way to find specific values within table

    thank you.

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

    Re: The fastest way to find specific values within table

    I will keep this post opened because i do not think so that provided code is the fastest way to copy filtered values from table.

    Maybe advance filter but advance filter has also restrictions...

    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. Replies: 5
    Last Post: 03-05-2017, 04:07 PM
  2. [SOLVED] Fastest Find Last Used Row in Worksheet
    By EssoExplJoe in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-25-2016, 07:24 PM
  3. [SOLVED] The fastest way to Distribute new Values in Table
    By toci in forum Excel Formulas & Functions
    Replies: 42
    Last Post: 05-30-2016, 03:37 PM
  4. [SOLVED] Fastest way to find a duplicate value in two large columns
    By ArnolddG in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-28-2014, 05:05 AM
  5. Replies: 1
    Last Post: 04-19-2013, 08:30 PM
  6. fastest way to find the row where a specific text is found in a specific column
    By getgray in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-23-2011, 02:45 PM
  7. [SOLVED] Fastest way to find item in an array.
    By WhytheQ in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-24-2006, 06:20 PM

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