+ Reply to Thread
Results 1 to 13 of 13

Quickest way to gather unique values in column - preferably without looping

  1. #1
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Quickest way to gather unique values in column - preferably without looping

    Hi guys,

    I've got a sheet with just over 250,000 rows in which I filter multiple columns based on dropdown values in another sheet.
    After all the filtering, I'd want to count the number of unique values in a filtered column - preferably without looping.
    I can't use advanced filter / copy unique values either.

    What's the quickest way?

    Thanks,

    Jasper

    ps - right now I'm using:

    Please Login or Register  to view this content.
    Please click the * below if this helps

  2. #2
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Quickest way to gather unique values in column - preferably without looping

    I suspect a Dictionary would be faster than string concatenation.
    Remember what the dormouse said
    Feed your head

  3. #3
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: Quickest way to gather unique values in column - preferably without looping

    Thanks Rory.
    How would I do that?

  4. #4
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Re: Quickest way to gather unique values in column - preferably without looping

    Good morning JasperD

    This method uses looping, but it's pretty rapid, using collections, rather than just comparing.
    Please Login or Register  to view this content.
    HTH

    DominicB

  5. #5
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Quickest way to gather unique values in column - preferably without looping

    "After all the filtering, I'd want to count the number of unique values in a filtered column - preferably without looping".
    If you do not want to loop over, another option would be to use a Pivot table though it may not be suitable for your requirements.

  6. #6
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: Quickest way to gather unique values in column - preferably without looping

    Depending on big picture of what you are doing and your work flow, you may want to explore using ADO and SQL to count the unique values, retrieve data, etc. e.g. separate the front-end UI (i.e. what's on the other sheet where you do the filtering) and the quasi DB (i.e. the sheet with 250K+ records). This way you can work with it without even opening the huge file.
    Further on you can use access or sqlite or even mysql (free) to store data in real DB.
    just my two cents. In a pure VBA I'm using the same approach as suggested by dominicb.
    Last edited by buran; 02-06-2015 at 02:38 PM.
    If you are pleased with a member's answer then use the Star icon to rate it.

  7. #7
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Quickest way to gather unique values in column - preferably without looping

    Dictionary version:
    Please Login or Register  to view this content.

  8. #8
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: Quickest way to gather unique values in column - preferably without looping

    Thanks guys!

    @Buran: Sounds awesome, got any good sites for me to read up about it?
    Thanks!

  9. #9
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: Quickest way to gather unique values in column - preferably without looping

    you can google ADODB Excel and it will return plenty of results, even videos on youtube on how to use ADO from excel.
    here is old thread where I've uploaded sample files for the other user.

  10. #10
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Quickest way to gather unique values in column - preferably without looping

    There are free versions of all RDMDS, but downloading the free SQL server requires a PHD on installation. It is absolute nightmare. I hope someone comes up an alternative to Windows, so that I can scrap MS altogether.
    IE sucks! I am glad, we now have other choices, like Fire. MS seems to me going back ward.

  11. #11
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: Quickest way to gather unique values in column - preferably without looping

    @AB33: I said MySQL, no MS SQL Server. No experience with MS SQL Server installation, but MySQL installation went well on several occasions I had to install it myself

  12. #12
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Quickest way to gather unique values in column - preferably without looping

    Hi Buran,
    I was not referring to MY sql directly as I have not tried it myself.

  13. #13
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: Quickest way to gather unique values in column - preferably without looping

    sorry, AB33, I misunderstood you :-)

+ 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] counting unique values in col A against unique value in column B
    By greyscale in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-08-2013, 08:43 AM
  2. High low chart in Excel (preferably with values horizontal)
    By rnp70 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 02-23-2013, 02:14 PM
  3. Count Unique Values In One Column Basis Unique Values in Another Column
    By shez_raz in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-07-2012, 01:55 AM
  4. Quickest alternative for shortcut of PasteSpecial then Values
    By rony4icab in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-18-2006, 04:10 AM
  5. Replies: 6
    Last Post: 02-18-2005, 10:06 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