+ Reply to Thread
Results 1 to 18 of 18

Pull uniques for large amounts of data

  1. #1
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Pull uniques for large amounts of data

    Hello everybody
    I have working code that pulls the unique values and it is working very well in this attachment but for real data it is very very slow
    so I as seeking to use arrays to do that task
    There's my code
    Please Login or Register  to view this content.
    The code copy column B to Column O
    Then >>
    in Column P it brings the unique items which exists in column C and doesn't exist in column O
    Then >>
    in Column Q it brings the unique items which exists in column D and doesn't exist in column O + Column P
    Then >>
    in Column R it brings the unique items which exists in column E and doesn't exist in column O + Column P + Column Q
    and so on
    This is the logic

    Hope it is clear
    You can run the macro to see the desired results
    Attached Files Attached Files
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  2. #2
    Forum Expert
    Join Date
    02-22-2013
    Location
    London, UK
    MS-Off Ver
    Office 365
    Posts
    1,218

    Re: Pull uniques for large amounts of data

    Hi buddy,

    See if this works and would speed things up;

    Please Login or Register  to view this content.
    //berlan

  3. #3
    Forum Contributor
    Join Date
    08-14-2013
    Location
    Florida
    MS-Off Ver
    Excel 2013
    Posts
    105

    Re: Pull uniques for large amounts of data

    Fully agree with berlan, a "Scripting.Dictionary" is the way to go. Well worth taking the time and effort to learn that reference library.

  4. #4
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Pull uniques for large amounts of data

    This just requires a reference set to Microsoft Scripting Runtime.

    Please Login or Register  to view this content.
    What's crazy is that I'm still pretty terrible with standard VBA arrays, but the scripting dictionary was easier to start off with. I just like not having to know the limit up front, or ReDim'ing anything for something dynamic.
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  5. #5
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Pull uniques for large amounts of data

    Thanks a lot great people Mr. Berlan and Mr. Daffodil
    I will try this on the real file and see the results ..
    Thank you very much
    Regards

  6. #6
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Pull uniques for large amounts of data

    Thank you very much for this gift ..Thanks alot for both of you
    YOU ARE AWESOME

  7. #7
    Forum Expert
    Join Date
    02-22-2013
    Location
    London, UK
    MS-Off Ver
    Office 365
    Posts
    1,218

    Re: Pull uniques for large amounts of data

    @daffodil11, nice work -- short and concise!! With with less interactions between cells and VBA it would come down in speed even more. Maybe consider using 'late binding' for simplicity in the final code so no reference to Microsoft Scripting Runtime is needed

    @YasserKhalil, you're welcome, your threads are always worth a challenge! And thanks for the rep added

    In terms of speed of running the different procedures on my PC (with the example workbook provided)
    - Original code, ~1.6 sec on average
    - My code, ~0.03 on average
    - daffodil11's code, ~0.2 on average

  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: Pull uniques for large amounts of data

    Hi Guys,

    Please Login or Register  to view this content.
    * I got .039 with this one
    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

  9. #9
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Pull uniques for large amounts of data

    I don't know the Late Binding for Scription.Dictionary yet!



    Soooooon!

  10. #10
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Pull uniques for large amounts of data

    Thanks a lot for all these wonderful contributions
    The time elapsed for each code:
    ------------------------------
    Berlan : 0.328
    Daffodil : 0.047
    Xladept : 0.438
    Me (The worst of course) : I won't mention my scandal

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

    Re: Pull uniques for large amounts of data

    I get .039 for mine .019 if I just clear contents

    I just ran Daffodil's in .0078! WOW!
    Last edited by xladept; 08-21-2015 at 03:59 PM.

  12. #12
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Pull uniques for large amounts of data

    What timing model are you folks using?

    I usually run X = timer, msgbox Timer - X. Is that normal?

  13. #13
    Forum Expert
    Join Date
    02-22-2013
    Location
    London, UK
    MS-Off Ver
    Office 365
    Posts
    1,218

    Re: Pull uniques for large amounts of data

    Berlan : 0.328
    haha, really??

    Using my laptop, I get 0.047 sec at best for yours xladept, 0.031 sec at best with mine, but I can't get the time down with Daffodil's using Excel 2016 -- very strange.

    Please Login or Register  to view this content.

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

    Re: Pull uniques for large amounts of data

    Excel 2016
    Didn't even know there was such an animal.
    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.

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

    Re: Pull uniques for large amounts of data

    This is how I time routines:

    Please Login or Register  to view this content.

  16. #16
    Forum Expert
    Join Date
    02-22-2013
    Location
    London, UK
    MS-Off Ver
    Office 365
    Posts
    1,218

    Re: Pull uniques for large amounts of data

    Didn't even know there was such an animal.
    A preview version of Excel 2016 I should add...



    @xladept, thanks for sharing..
    Last edited by berlan; 08-21-2015 at 04:59 PM.

  17. #17
    Valued Forum Contributor
    Join Date
    03-21-2013
    Location
    cyberia
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: Pull uniques for large amounts of data

    Those of you interested in speed for this problem as stated would be better off scrubbing the dictionary approach entirely and trying something like the following:
    Please Login or Register  to view this content.
    The timing difference should really show up in a more realistic sized data set, say up to 10,000 rows as indicated in the opening post.
    Or you could try it on a million rows and see how long the dictionary approach takes. Maybe you'd be waiting for some time.

  18. #18
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Pull uniques for large amounts of data

    Mr. Kalak
    You are genius. That's very great solution too
    I'm learning a lot from you great guys

+ 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] HELP - This Macro works on small amounts of data but fails on large amounts
    By BookmanNLA in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-18-2015, 12:40 AM
  2. Large amounts of data
    By namluke in forum Excel General
    Replies: 3
    Last Post: 12-11-2014, 02:40 PM
  3. Transposing large amounts of data
    By salva7ore in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-12-2014, 06:52 AM
  4. Help Transposing Large Amounts of Data
    By NFT86 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-11-2014, 06:05 PM
  5. Updating Large Amounts of Data
    By s.custo2011 in forum Excel General
    Replies: 3
    Last Post: 02-20-2014, 01:40 AM
  6. Excel 2007 : Filtering large amounts of data
    By as1508 in forum Excel General
    Replies: 9
    Last Post: 05-22-2012, 12:40 PM
  7. Large Amounts of Data
    By Drewser33 in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 06-17-2008, 09:13 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