+ Reply to Thread
Results 1 to 9 of 9

Count duplicates in several columns

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

    Count duplicates in several columns

    Hello everyone

    In Sheet1 I have range of values in range("B3:F25") .. and I need to do some processes on these values
    Manually I copy this range and put it to range("K3:O25") then sort this new range according to the five columns by column K & L & M & N & O
    After that I had to extract the duplicates in the five columns and count them
    then to extract the duplicates in four columns and count them
    then extract the duplicates in three columns and count them
    then extract the duplicates in two columns and count them

    I have attached the expected and final desired output in columns S:X and leave three blank rows in between each set of results
    Thanks advanced for help
    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 Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Count duplicates in several columns

    Maybe :
    Please Login or Register  to view this content.
    1. I care dog
    2. I am a loop maniac
    3. Forum rules link : Click here
    3.33. Don't forget to mark the thread as solved, this is important

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

    Re: Count duplicates in several columns

    Hello Mr. Karedog
    In fact the words would not be enough to thank you .. You are really wonderful and awesome
    Thank you very much for this great help

    Just need to get these two lines
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    And as for the sort process is it important here? I think it is not important ..
    I just put it in the sample file so as to show the manual steps that make the work easier (that's all) but as you in wonderful way stored it in array, I think I will do without this part.. Just tell me if I am right or not

    Best and kind regards

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

    Re: Count duplicates in several columns

    Now I used this fantastic code (deleted all the columns that were put for illustration and got the desired results as expected exactly)
    Please Login or Register  to view this content.
    How can I merge the headers of Duplicates In ... in easier way?

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

    Re: Count duplicates in several columns

    You are welcome. Just add/modify the last part of the code :
    Please Login or Register  to view this content.
    Regards

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

    Re: Count duplicates in several columns

    Thank you very much my best tutor ..
    Waiting for explaining the two lines I referred to in post #3

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

    Re: Count duplicates in several columns

    Quote Originally Posted by YasserKhalil View Post
    Please Login or Register  to view this content.
    If we only have one collection, say :
    Please Login or Register  to view this content.
    then the syntax to add data to the collection would be :
    Please Login or Register  to view this content.
    But if we have many collections with uniform structures, we can set array where each of its member is a collection.

    It is like you have many variables vs you put them in single array like this :
    - Many variables :
    Please Login or Register  to view this content.
    - Using array :
    Please Login or Register  to view this content.
    The same thing applied to collection, if you have many collections, your code would be like this :
    - Many collections :
    Please Login or Register  to view this content.
    - Using array :
    Please Login or Register  to view this content.





    Quote Originally Posted by YasserKhalil View Post
    Please Login or Register  to view this content.
    I have once answer your question about collection inside collection (nested).
    Collection can store any kind of variables, arrays, and classes.
    So you can :
    Please Login or Register  to view this content.
    If we want to access an array, we will call it through its index, for example :
    Please Login or Register  to view this content.
    So now we put it all together :
    - to access the member of single collection, it would be :
    Please Login or Register  to view this content.
    - to access the member of arrayed collection, it would be :
    Please Login or Register  to view this content.
    - If the value stored in ".item" is an array, to access the member of this array would be :
    Please Login or Register  to view this content.
    where (0), (1), (2), etc, is index of the array, just like "arr = Array(1, 2, 3) --> Debug.print arr(1)"

    - So to access the child collection of big the collection, the index to be used is 1 (because it is zero based index, created using "Array(strKey, New Collection)" syntax) :
    Please Login or Register  to view this content.
    - To add some data to this child collection, the syntax is :
    Please Login or Register  to view this content.

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

    Re: Count duplicates in several columns

    That's marvelous and fascinating .. You are a great tutor and I enjoyed this tutorial a lot
    Thank you very very much Mr. Karedog
    Best and kind regards

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

    Re: Count duplicates in several columns

    You are welcome Mr.Yasser Khalil, glad I can help.

    Regards

+ 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] Count Unique Values with Duplicates in Multiple Columns
    By sTeezZy in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 05-26-2016, 05:50 PM
  2. Replies: 3
    Last Post: 10-23-2014, 04:50 PM
  3. Replies: 1
    Last Post: 06-19-2014, 06:35 PM
  4. [SOLVED] Count duplicates and duplicates with suffix as one instance
    By ruraljur0r in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-24-2014, 12:38 AM
  5. Removing duplicates in a count, count based on value in a different cell
    By omf_24 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 10-10-2013, 07:08 AM
  6. Replies: 17
    Last Post: 07-05-2011, 05:37 PM
  7. Using a Formula to Count Duplicates in two Columns
    By JungleJme in forum Excel General
    Replies: 2
    Last Post: 08-25-2010, 07:01 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