+ Reply to Thread
Results 1 to 15 of 15

Using Macro to Extract unique data with multiple criteria

  1. #1
    Registered User
    Join Date
    12-29-2011
    Location
    ShangHaii, China
    MS-Off Ver
    Excel 2003, 2010
    Posts
    30

    Using Macro to Extract unique data with multiple criteria

    Dear all,

    I have a spreadsheet include 3 columns and 20000 rows, I attached my sample file as below. I want to use dictionary object to extract data in this case. Now I must filter by manual, It takes alot of time. Please help me to improve it.

    Thanks in advanced.
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    12-29-2011
    Location
    ShangHaii, China
    MS-Off Ver
    Excel 2003, 2010
    Posts
    30

    Re: Using Macro to Extract unique data with multiple criteria

    Who can help me?

  3. #3
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Using Macro to Extract unique data with multiple criteria

    Try this.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by skywriter; 11-09-2015 at 09:14 PM.
    Click the * Add Reputation button in the lower left hand corner of this post to say thanks.

    Don't forget to mark this thread SOLVED by going to the "Thread Tools" drop down list above your first post and choosing solved.

  4. #4
    Registered User
    Join Date
    12-29-2011
    Location
    ShangHaii, China
    MS-Off Ver
    Excel 2003, 2010
    Posts
    30

    Re: Using Macro to Extract unique data with multiple criteria

    Thank Skywrite so much.

    But the result show incorrect, not match with the result that I wrote in my file above.

    When I filter Store Column with criteria : CA001 and Filter Code Column HA001, Price show 10, 10, 10. It is the same Price is 10, I ignore this value, don not get data to Result range.

    Could you help me to improve this code.

  5. #5
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Using Macro to Extract unique data with multiple criteria

    You said you wanted to use a dictionary which is how you create a unique list. I gave you a unique list. It's not apparent to me by your example what you are trying to do. Anyway I spent a while putting this together, so I'm done. Good Luck.

  6. #6
    Registered User
    Join Date
    12-29-2011
    Location
    ShangHaii, China
    MS-Off Ver
    Excel 2003, 2010
    Posts
    30

    Re: Using Macro to Extract unique data with multiple criteria

    Thank you very much.

    So how to improve your code to get data that I desire?

    Thank for your help.

  7. #7
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Using Macro to Extract unique data with multiple criteria

    If you can drop the requirement to use dictionary, you can try this :

    Please Login or Register  to view this content.

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

    Re: Using Macro to Extract unique data with multiple criteria

    Xiaojiang

    If you can upload a workbook with EXACT desired result based on the data you uploaded in your first post, it will be clearer to understand how you want it.

  9. #9
    Registered User
    Join Date
    12-29-2011
    Location
    ShangHaii, China
    MS-Off Ver
    Excel 2003, 2010
    Posts
    30

    Re: Using Macro to Extract unique data with multiple criteria

    Thank Karedog alot.

    The result show correct as my request. You use colllection in this case.

    I really want to use Dictionary Object in this case, but I can not find out the algorithm for dictionary object in this case.

    Could you help me?

  10. #10
    Registered User
    Join Date
    12-29-2011
    Location
    ShangHaii, China
    MS-Off Ver
    Excel 2003, 2010
    Posts
    30

    Re: Using Macro to Extract unique data with multiple criteria

    Quote Originally Posted by jindon View Post
    Xiaojiang

    If you can upload a workbook with EXACT desired result based on the data you uploaded in your first post, it will be clearer to understand how you want it.
    Hi Jindon,

    Thank you very much for your concern with my problem.

    The exact desired result like the result range that I describe in my first post. Raw data : Range("C4 : E19") and Result show as Range("I4 : K9"). But I want use dictionary object in this case not Collection as karedog do it above. I really can not find out the algorithm if I use dictionary object.
    I know you are good at in using dictionary object.

    Could you help me?

    Thanks so much.

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

    Re: Using Macro to Extract unique data with multiple criteria

    OK, I read through your workbook...
    This is how I read your problem.
    Result will be output at M3
    Run the code with your uploaded workbook.
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    12-29-2011
    Location
    ShangHaii, China
    MS-Off Ver
    Excel 2003, 2010
    Posts
    30

    Re: Using Macro to Extract unique data with multiple criteria

    Hi Jidon,

    Thank you very much for your help. But when I run code, it show error in this line : Set .Item(a(i, 1))(a(i, 2)) = CreateObject("System.Collections.ArrayList")

    I think may be my computer does set up Framework.

    So if I do not Sort Array, how to change your code? It mean the result show data as I desire but no need to sort Array, no need to group follow Store column and Code Column.

    Thanks
    Last edited by Xiaojiang; 11-09-2015 at 11:35 PM.

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

    Re: Using Macro to Extract unique data with multiple criteria

    What's your Window version?

    Try this then
    Please Login or Register  to view this content.

  14. #14
    Registered User
    Join Date
    12-29-2011
    Location
    ShangHaii, China
    MS-Off Ver
    Excel 2003, 2010
    Posts
    30

    Re: Using Macro to Extract unique data with multiple criteria

    Hi Jidon,

    It works very well. I read a lot of post that you write dictionary code and I like the way that you use dictionary Object.

    Thanks a lot.

    And thank all member that help me in this topic.

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

    Re: Using Macro to Extract unique data with multiple criteria

    You are welcome and thanks for the rep.

+ 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] Extract unique data from multiple columns
    By gak67 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-09-2015, 10:51 PM
  2. Extract data from multiple columns, group and sum up unique values
    By Alcotraz in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-05-2015, 06:54 PM
  3. How to extract data based on multiple criteria
    By NS4Excel in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-11-2015, 07:56 PM
  4. [SOLVED] Extract Unique Text Values based on Multiple Criteria
    By Kattenhove in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 09-26-2014, 07:59 AM
  5. Extract data from Excel Worksheet using multiple criteria
    By Beudean Dorin in forum Excel General
    Replies: 0
    Last Post: 03-26-2013, 01:31 PM
  6. Extract Data Based on Multiple Criteria
    By trevaaaaaaa in forum Excel General
    Replies: 2
    Last Post: 03-14-2012, 11:42 AM
  7. Replies: 2
    Last Post: 03-23-2011, 06:19 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