Consulting

Page 1 of 2 1 2 LastLast
Results 1 to 20 of 26

Thread: counting duplicates and displaying the value

  1. #1
    VBAX Contributor
    Joined
    Nov 2006
    Posts
    107
    Location

    counting duplicates and displaying the value

    I have 6 values in a column. example

    14236
    14238
    14236
    14234
    14238
    14567

    I'd like to crop this column and have unique values displayed in a different column. I'd also like the number of times the values have been duplicated beside the number.

  2. #2
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Take a look at the code in this attachment pico. Removed duplicates in column A as set up and reports in column C.....
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3
    VBAX Contributor
    Joined
    Nov 2006
    Posts
    107
    Location
    Is there a way i can do this in excel without using vba?. I dont want to remove the rows. Sorry must have confused you when i said crop. I'd like to display the values and the number of times they have been duplicated.

  4. #4
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    just put an apostrophe in front of this line as shown here:
    [VBA]
    'Rows(Row).Delete
    [/VBA]
    It still needs to sort them though, will that cause a problem?
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  5. #5
    VBAX Contributor
    Joined
    Nov 2006
    Posts
    107
    Location
    Is there a solution using excel formulas? maybe exact and count?...No vba please

  6. #6
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    give me a minute. I think so
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  7. #7
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Try this pico, you have to autofilter first....then use formula's for the count.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  8. #8
    VBAX Contributor
    Joined
    Nov 2006
    Posts
    107
    Location
    The autofilter method is too tedious. I'd like to automatically output the result without the user having to use excel. I have been trying to come up with a solution using exact and countif ...but the solution still eludes me. Thank you for the help anyway.

  9. #9
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    I will revisit this later but its a holiday here and family duties call so I must abandon you for now....sorry.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  10. #10
    VBAX Contributor
    Joined
    Nov 2006
    Posts
    107
    Location
    HAPPY THANKSGIVING!

  11. #11
    VBAX Contributor
    Joined
    Nov 2006
    Posts
    107
    Location

    Excel Functions, exact, countif

    Can anyone give me a solution regarding this problem using excel functions? no vba please. I'd like to automatically count the number of duplicates

  12. #12
    VBAX Expert Shazam's Avatar
    Joined
    Sep 2005
    Posts
    530
    Location
    Quote Originally Posted by pico
    Can anyone give me a solution regarding this problem using excel functions? no vba please. I'd like to automatically count the number of duplicates

    You can use this formula to extract unique values. Input formula in cell F2 and copy down.

    The formula is an-array must hold down:

    Ctrl,Shift,Enter

    =INDEX($A$2:$A$30,MATCH(TRUE,ISNA(MATCH($A$2:$A$30,F$1:F1,0)),0))

    I attach a sample workbook below.
    SHAZAM!

  13. #13
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Try this

  14. #14
    VBAX Contributor
    Joined
    Nov 2006
    Posts
    107
    Location
    Shazam i tried using your solution. But i cant seem to replicate the formula properly. I have attached my file.

  15. #15
    VBAX Expert Shazam's Avatar
    Joined
    Sep 2005
    Posts
    530
    Location
    Look at the attachment below.
    SHAZAM!

  16. #16
    VBAX Contributor
    Joined
    Nov 2006
    Posts
    107
    Location
    K. I Should have included the formulas needed to calculate the values earlier. Your new formula you provided does not seem to work when iam using the lookup function to calculate my table

  17. #17
    VBAX Expert Shazam's Avatar
    Joined
    Sep 2005
    Posts
    530
    Location
    Quote Originally Posted by pico
    K. I Should have included the formulas needed to calculate the values earlier. Your new formula you provided does not seem to work when iam using the lookup function to calculate my table

    It works for me. Look at the samlpe workbook below.
    SHAZAM!

  18. #18
    VBAX Contributor
    Joined
    Nov 2006
    Posts
    107
    Location
    Hi Shazam the code works thank you. Would you mind explaining what the 10^307 does in the formula? =LOOKUP(10^307,CHOOSE({1,2},0,INDEX($B$38:$B$42,MATCH(TRUE,ISNA(MATCH($B$38 :$B$42,B$43:B43,0)),0))))

  19. #19
    VBAX Expert Shazam's Avatar
    Joined
    Sep 2005
    Posts
    530
    Location
    Quote Originally Posted by pico
    Hi Shazam the code works thank you. Would you mind explaining what the 10^307 does in the formula? =LOOKUP(10^307,CHOOSE({1,2},0,INDEX($B$38:$B$42,MATCH(TRUE,ISNA(MATCH($B$38 :$B$42,B$43:B43,0)),0))))

    CHOOSE function has 2 value arguments. The first formula is the Zero string. The second is your INDEX function. The array of numbers {1,2} is how the CHOOSE Function returns an array of values, not just one. LOOKUP(10^307 then returns the last value in this array. The standard way is the 9.99999999999999E+307 not the 10^307 .
    SHAZAM!

  20. #20
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by Shazam
    The standard way is the 9.99999999999999E+307 not the 10^307 .
    But totally counter-intuitive, whereas 10^307 isn't, and very hard to type in. I personally use 1E+300, or even 99^99, it is just a very large number required, it isn't really necessary to be the biggest Excel can hold.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •