+ Reply to Thread
Results 1 to 17 of 17

Count unique from three columns

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

    Count unique from three columns

    Hello everyone
    I have two sheets where I would like to count the unique items from both sheets (I mean if the same data from three columns from both sheets are the same then this would be counted as just 1)
    But if the same data repeated with no equivalent in the other sheet then this would be counted as new 1

    To clarify the issue I have copied the data from both sheets (Repair & Check) and put the data in sheet Report in columns E to O then rearrange data so as to make visual analysis of the existing data and the expected count put in column O
    Finally I would like to get the same result as in Report column B

    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 Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Count unique from three columns


    Hi !

    As you already know how to use a dictionary …

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

    Re: Count unique from three columns

    The issue is that the data is in two sheets and the data should be compared across three columns (in real file the columns are non-adjacent)
    And the count should be once if the item exists once in both sheets
    but if the same item repeated in one sheet again it will be counted again
    Please have a look at the Report sheet ..

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

    Re: Count unique from three 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

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

    Re: Count unique from three columns

    Thank you very much my friend. That's really amazing and very quick
    Can I get the results in column B only as the column A will be input and the site numbers will not be in that order ..so I just need the results in column B based on the input in column A?
    And I will study the code carefully so as to make use of it and so as to apply it on the original file which is different somewhat in structure

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

    Re: Count unique from three columns

    You are welcome, thanks for reps.
    You mean a case where "Site no" is not integer, but other data types like string ?

    Then :
    Please Login or Register  to view this content.

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

    Re: Count unique from three columns

    Thanks again for your great efforts and the second one is more perfect
    What I need is not to get the first column by the code itself .. the first column which is the site no will be user's input and the second result which is the total is the required by the code
    So the user may input just three sites of all the sites then he would run the code to get the count of those three sites only
    I can use the code to a temporary range then using Vlookup ... but I am seeking for the best all the time as you know
    Thank you very much

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

    Re: Count unique from three columns

    Should be :
    Please Login or Register  to view this content.

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

    Re: Count unique from three columns

    Thank you very much for amazing solutions. Thanks a lot for great help all the time.
    Best and Kind Regards my friend

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

    Re: Count unique from three columns

    You are welcome, thanks for marking the thread as solved.

    Regards

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

    Re: Count unique from three columns

    In this line
    Please Login or Register  to view this content.
    You left the first two elements empty. Is that necessary to the code as I am trying to study the code?

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

    Re: Count unique from three columns

    Not necessary, I just add those 2 empty elements, so the index (column position) of array c will be same (no need to do another mathematic computation) with the examined sheet.

    You can also do it like this (without empty elements) :
    Please Login or Register  to view this content.
    You see, at the last red line you need to add the index by 2

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

    Re: Count unique from three columns

    Thanks a lot for your guide and forgive me if I would ask more questions as your codes is considered as big resource for learning.

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

    Re: Count unique from three columns

    Sorry for disturbing you again. I have applied the code to the following file but it seems that the result is incorrect as for example site 1 in Test sheet is 712 and in Repair sheet is 151 and the result is just 151
    Can you please have a look?
    Attached Files Attached Files

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

    Re: Count unique from three columns

    Because your code on this line :
    Please Login or Register  to view this content.
    should be :
    Please Login or Register  to view this content.

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

    Re: Count unique from three columns

    That's great. sorry for this bug. That was my fault (I didn't pay attention to that although I have reviewed the code several time)
    Regards

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

    Re: Count unique from three columns

    Not to worry about it.

    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] Formula to count unique columns
    By rmlucas in forum Excel General
    Replies: 6
    Last Post: 05-15-2017, 09:51 AM
  2. [SOLVED] Count unique date from two columns
    By TK2013 in forum Excel General
    Replies: 10
    Last Post: 08-16-2016, 04:26 AM
  3. [SOLVED] Count Unique Items in a Column Based on Unique Items in Two Other Columns
    By HangMan in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 10-31-2015, 04:48 PM
  4. [SOLVED] Count unique from three columns
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-28-2015, 09:08 PM
  5. [SOLVED] count unique entries in 2 columns
    By VickiVA in forum Excel General
    Replies: 6
    Last Post: 08-05-2015, 09:26 AM
  6. [SOLVED] Sort and Count Unique List Across Multiple Columns - Student Count
    By BuntyMac in forum Excel Formulas & Functions
    Replies: 22
    Last Post: 08-17-2014, 07:00 AM
  7. [SOLVED] Count unique value for each row in a number of Columns
    By rickyilas in forum Excel General
    Replies: 6
    Last Post: 05-23-2012, 09:14 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