+ Reply to Thread
Results 1 to 45 of 45

Vb code or Excel formula Help for unique rows

  1. #1
    Forum Contributor
    Join Date
    01-21-2011
    Location
    London,UK
    MS-Off Ver
    Excel 2007
    Posts
    241

    Question Vb code or Excel formula Help for unique rows

    hello,
    i have a list of 5775 rows ,what i need is to get unique rows from this list.every string must be used only once no repeat.the final result is going to be 165 unique rows.like in example
    in the attachment.
    so is there any excel formula or Vb code to solve this?
    thanks in advace for any help.
    SEM
    Attached Files Attached Files

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Vb code or Excel formula Help for unique rows

    use advanced filter on column A filter on unique rows copy paste the results to a new set of columns
    hm not sure what makes unique here
    Last edited by martindwilson; 05-21-2011 at 09:02 AM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Forum Contributor
    Join Date
    01-21-2011
    Location
    London,UK
    MS-Off Ver
    Excel 2007
    Posts
    241

    Red face Re: Vb code or Excel formula Help for unique rows

    Thanks Martin i tried Advanced Filtering but that gives or copies column "A"only
    what i need to include column "C" and "B" in the result.unless i'm doing something wrong.
    would you care to explain how,if you dont mind?
    Have a good day

    Sem

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Vb code or Excel formula Help for unique rows

    filter on a
    copy a,b and c
    paste somewhere

  5. #5
    Forum Contributor
    Join Date
    01-21-2011
    Location
    London,UK
    MS-Off Ver
    Excel 2007
    Posts
    241

    Re: Vb code or Excel formula Help for unique rows

    hello Martin,
    thanksfor for your help but filterin is not working ,see attachment for the result;
    have a nice day
    sem
    Attached Files Attached Files

  6. #6
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Vb code or Excel formula Help for unique rows

    i get this
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    01-21-2011
    Location
    London,UK
    MS-Off Ver
    Excel 2007
    Posts
    241

    Red face Re: Vb code or Excel formula Help for unique rows

    Hello Martin
    thanks for the effort but still not the right result
    column"M" is ok but if you look to column"N" and "O" thre are alot of duplicate ie;
    "O2.....O6",09 10 11 12" N6...N10 ;04 05 06 07.....and so on .my 4 rows example
    are all unique no duplicate.what i needis similar to column"M"no repeat.
    01 02 03 04 05 06 07 08, 09 10 11 12 in this row 2nd and 3rd
    number string must not be used again in column "N" or "O.
    I hope i explained my problem..
    thank you again for your time.

    Sem

  8. #8
    Forum Contributor
    Join Date
    01-21-2011
    Location
    London,UK
    MS-Off Ver
    Excel 2007
    Posts
    241

    Red face Re: Vb code or Excel formula Help for unique rows

    Good Morning,
    will it make any difference if i concatenate 3 column to 1 to solve this problem.
    see attachment "sheet 2".out of 5775 rows i need only 165 unique rows
    with no duplication.
    thanks in advance for any assistance.
    Sem
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    05-22-2011
    Location
    Delhi-NCR
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: Vb code or Excel formula Help for unique rows

    Hi,
    First, Kindly add new worksheet as sheet2. Give list titles: LIST-1 LIST-2 LIST-3.

    Please use this VBA code:

    Sub Unique()
    Sheets("Sheet1").Select
    Columns("A:A").Select
    Range("A1:A5776").AdvancedFilter Action:=xlFilterInPlace, Unique:=True
    Range("A1").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.SpecialCells(xlCellTypeVisible).Select
    Selection.Copy
    Sheets("Sheet2").Select
    Range("A1").Select
    ActiveSheet.Paste
    Columns("A:A").EntireColumn.AutoFit
    Application.CutCopyMode = False
    Sheets("Sheet1").Select
    Range("A1").Select
    ActiveSheet.ShowAllData
    Columns("B:B").Select
    Range("B1:B5776").AdvancedFilter Action:=xlFilterInPlace, Unique:=True
    Range("B1").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.SpecialCells(xlCellTypeVisible).Select
    Selection.Copy
    Sheets("Sheet2").Select
    Range("B1").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Sheets("Sheet1").Select
    Range("B1").Select
    ActiveSheet.ShowAllData
    Columns("C:C").Select
    Range("C1:C5776").AdvancedFilter Action:=xlFilterInPlace, Unique:=True
    Range("C1").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.SpecialCells(xlCellTypeVisible).Select
    Selection.Copy
    Sheets("Sheet2").Select
    Range("C1").Select
    ActiveSheet.Paste
    Cells.Select
    Cells.EntireColumn.AutoFit
    Range("A1").Select
    End Sub
    Attached Files Attached Files
    Last edited by madhikari; 05-22-2011 at 07:33 AM. Reason: To upload attachment

  10. #10
    Forum Contributor
    Join Date
    01-21-2011
    Location
    London,UK
    MS-Off Ver
    Excel 2007
    Posts
    241

    Red face Re: Vb code or Excel formula Help for unique rows

    Hello Madhikari,
    thank you for your help, but this code doing each column Advance Filtering ,the end result
    is not correct,if you check in LIST2 string starting with"05.","04.","03.." you'll see duplicate of them in LIST3 and string numbers starting with "02..."are out of 165 rows range .the right result should be no duplicate of string,no duplicate number in any row aswell and the 3 lists must be equal "1-165 rows".
    i hope i explained clearly.
    thank and God Bless
    Sem

  11. #11
    Forum Contributor
    Join Date
    01-21-2011
    Location
    London,UK
    MS-Off Ver
    Excel 2007
    Posts
    241

    Question Re: Vb code or Excel formula Help for unique rows

    Good Morning,
    Any other suggestion apart from Advance filtering,would be much appreciated.
    thank you....
    Sem

  12. #12
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Vb code or Excel formula Help for unique rows

    i still cant see what makes unique ther are 165 unique values in column a alone

  13. #13
    Forum Contributor
    Join Date
    01-21-2011
    Location
    London,UK
    MS-Off Ver
    Excel 2007
    Posts
    241

    Red face Re: Vb code or Excel formula Help for unique rows

    Hello Martin,
    Thank you for your interest in this tread i realy appreciated.
    all columns must be unique and in a way connected.in attachment i gave different list for
    example.also i gave the original Combin(12,4) thats where i got my list.
    Thank you again and God Bless
    Sem
    Attached Files Attached Files

  14. #14
    Forum Contributor
    Join Date
    01-21-2011
    Location
    London,UK
    MS-Off Ver
    Excel 2007
    Posts
    241

    Question Re: Vb code or Excel formula Help for unique rows

    Good Evening,
    Just to give you more information;
    In my first attachment List every string with 4 numbers are used 35 times,and every row
    up to 5775 contain numbers from "1" to "12".when i use advance filtering
    there are duplicate numbers in rowshere an example;
    01 02 03 05, 05 06 07 09, 08 10 11 12
    01 02 03 06, 05 06 07 10, 08 09 11 12
    01 02 03 07, 05 06 07 11, 08 09 10 12
    01 02 03 08, 05 06 07 12 ,08 09 10 11
    01 02 03 09, 05 06 08 09, 07 10 11 12
    in short my final result would be no duplicate in a row and every string of 4 numbers to be used once only.
    Thank you for patience with me and God Bless
    Sem

  15. #15
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Vb code or Excel formula Help for unique rows

    not in the list as in post #6 show some that are wrong

  16. #16
    Forum Contributor
    Join Date
    01-21-2011
    Location
    London,UK
    MS-Off Ver
    Excel 2007
    Posts
    241

    Red face Re: Vb code or Excel formula Help for unique rows

    Good Evening Martin,
    thanks for your time ,and i'm sorry for the trouble but i spent more than 4 hours last night
    trying with Advance filtering but to no avail.either there are repeat or duplicate string
    unfortunately for me ,it was waste of time.
    i think it have to be Vb code to sort this problem,but i might be wrong ???
    here is some adjestment to your post #6 attachmentjust to show you some of the string numbers total.as i said before every string(array) numbers must be used and only once .it does not matter which column they are in.
    thank you and God Bless
    Sem
    Attached Files Attached Files

  17. #17
    Forum Contributor
    Join Date
    01-21-2011
    Location
    London,UK
    MS-Off Ver
    Excel 2007
    Posts
    241

    Red face Re: Vb code or Excel formula Help for unique rows

    Good Morning,
    I would realy appreciate for any help please,Thanks.
    Sem

  18. #18
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Vb code or Excel formula Help for unique rows

    there are 495 unique values
    Attached Files Attached Files

  19. #19
    Forum Contributor
    Join Date
    01-21-2011
    Location
    London,UK
    MS-Off Ver
    Excel 2007
    Posts
    241

    Red face Re: Vb code or Excel formula Help for unique rows

    Hello Martin,
    thanks for your time,that list in your last attachment is ,my original list where i got
    "combin(495,3)=20092215 rows" then i reduce it to 5775 rows.But in that list every string(array)of 4 numbers occur 35 times,what i need is to reduce 5575 rows list to 165 unique
    rows each string to occur once only with out changing originality of the rows which is to have number"1" to "12" in them.
    thanks again for your invaluable help.
    Sem
    Attached Files Attached Files

  20. #20
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Vb code or Excel formula Help for unique rows

    sorry but there are not 165 unique rows of non repeating data ,well i cant see that.

  21. #21
    Forum Contributor
    Join Date
    01-21-2011
    Location
    London,UK
    MS-Off Ver
    Excel 2007
    Posts
    241

    Red face Re: Vb code or Excel formula Help for unique rows

    good evening,
    there are 165 unique rows as i said before every string of 4 numbers occur 35 times in that list "5775/35=165" and to find it manualy would take long time .That is why i'm seeking
    excel formula or VB code to solve this,Anyway thanks for your time and effort.
    Sem

  22. #22
    Forum Contributor
    Join Date
    01-21-2011
    Location
    London,UK
    MS-Off Ver
    Excel 2007
    Posts
    241

    Red face Re: Vb code or Excel formula Help for unique rows

    Good day everybody,
    this is how far i could do manualy,but it took me very long time to achive this.
    See attachment;
    would some please tell me if this solution would be achived with excel formula or Vb code?
    i would be very greatful for valuable advice.
    Thanks and Kind regards
    Attached Files Attached Files

  23. #23
    Forum Contributor
    Join Date
    01-21-2011
    Location
    London,UK
    MS-Off Ver
    Excel 2007
    Posts
    241

    Red face Re: Vb code or Excel formula Help for unique rows

    I'm realy, very sorry for all this trouble..
    i would appreciate for any suggestion to solve this problem.even if i have to search it in different website , with any link you could provide.
    Have a good day
    sem

  24. #24
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,607

    Re: Vb code or Excel formula Help for unique rows

    Check blue and red cells...

    I don't know why you have so short list from B column?
    Attached Files Attached Files

  25. #25
    Forum Contributor
    Join Date
    01-21-2011
    Location
    London,UK
    MS-Off Ver
    Excel 2007
    Posts
    241

    Red face Re: Vb code or Excel formula Help for unique rows

    Good Afternoon,
    Thanks Zbor for your help and effort,actually Column "A" is the shortes list after A. filtering
    and column "B" is the longest the reason they have duplicate string.when i get my correct result all 3 columns should be the same as column "A" with 165 rows.
    If you look at my expected result columns "H"and "I" they dont have any duplicate so far
    with the helper columns "J :M" if you try to insert any row with red colour string, it would change to a green colour that mean its duplicate so you change it and choose different one with "0".I hope explained clearly.
    Thanks for your time
    sem

  26. #26
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,607

    Re: Vb code or Excel formula Help for unique rows

    Sorry, I still can't get logic of it :/

  27. #27
    Forum Contributor
    Join Date
    01-21-2011
    Location
    London,UK
    MS-Off Ver
    Excel 2007
    Posts
    241

    Red face Re: Vb code or Excel formula Help for unique rows

    Hello,
    Zbor here an example from 3480 rows there are only 5 unique rows
    which each row used only once and each row have number "1" to "16",
    i hope this will shed light to the problem.
    Have a nice day.
    thanks
    sem
    Attached Files Attached Files

  28. #28
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,607

    Re: Vb code or Excel formula Help for unique rows

    Found it...

    Good explanations is also important as good result
    Attached Files Attached Files

  29. #29
    Forum Contributor
    Join Date
    01-21-2011
    Location
    London,UK
    MS-Off Ver
    Excel 2007
    Posts
    241

    Re: Vb code or Excel formula Help for unique rows

    Good afternoon Zbor,
    thank you very very much for wonderful help..appreciated very much.
    But can explain some part of the formula please;
    Please Login or Register  to view this content.
    and how can i implement this formula to my original list?

    thanks and God Bless
    sem

  30. #30
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,607

    Re: Vb code or Excel formula Help for unique rows

    Here is explanation (using ; as delimiter instead of , but doesn't matter):

    =IF(COUNTIF($A$2:A2;A2)=1;IF(MAX(LEN(" "&A2&" "&B2&" "&C2&" ")-LEN(SUBSTITUTE(" "&A2&" "&B2&" "&C2&" ";" "&TEXT(ROW($A$1:$A$12);"00")&" ";"")))<=4;ROW(E2);"");"")

    I'll separate it in 2 IF functions.

    First IF function retur unique value in A column

    COUNTIF($A$2:A2;A2)=1

    So if this count is 1 (that's unique value) calulate or if not leave blank.
    2nd IF function say:

    Join together three column separated with " " (but also with blank at first and last place).

    So from 01 02 03 0405 06 07 0809 10 11 12
    you get 01 02 03 04 05 06 07 08 09 10 11 12

    Now... replace each number with 01.
    Then replace each with 02 etc.

    that's what SUBSTITUTE(" "&A2&" "&B2&" "&C2&" ";" "&XXX&" ";"")

    where XXX is TEXT(ROW($A$1:$A$12);"00") that would create array number (01, 02, 03, ..., 12)

    And " "&XXX&" " will add " " at beggining and end of text giving _01_, _02_, etc

    LEN of original string minus LEN of each string will give you something like:

    =37-{33,33,33,33,33,33,33,33,33,33,33,33}
    ={4,4,4,4,4,4,4,4,4,4,4,4}

    if each string is substituted only once.

    If it's more than once you will get something like:

    =37-{33,29,29,33,33,33,33,33,37,33,33,37}
    ={4,8,8,4,4,4,4,4,0,4,4,0}

    meaning that numbers 2 and 3 are replaced twice, and numbers 9 and 12 none.

    So MAX of it will return:

    4 in first place
    8 (or more) in any other case, meaning there are duplicated values so can not be unique...

    IF it's unique return ROW number, else leave blank.

    So =INDEX(A$2:A$10000;SMALL($D$2:$D$10000;ROWS($F$2:$F2)))

    look in A column and return smallest row number, and how you go down it will increase. (Look more about SMALL function... this returns SMALL(array, 1), SMALL(array, 2), SMALL(array, 3) etc)
    Attached Files Attached Files

  31. #31
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,607

    Re: Vb code or Excel formula Help for unique rows

    Now when I looking maybe its better to say:

    IF MIN(LEN(.) - LEN(..) = 0) then MAX is 4... But that's finness...

    If you manage to change it that means you get the function

  32. #32
    Forum Contributor
    Join Date
    01-21-2011
    Location
    London,UK
    MS-Off Ver
    Excel 2007
    Posts
    241

    Red face Re: Vb code or Excel formula Help for unique rows

    Good evening Zbor,
    I'm indebted for all your ingenious effort and help ,but unfortunately still did not solve my problem .Because if you look in your last attachment in second and third column's of the result there are alot of duplicate ,i know they are unique in a way but they are duplicate..
    I dont expect you to to give your time anymore for that I salute you....
    Have a Nice evening,and God Bless
    SEM

  33. #33
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,607

    Re: Vb code or Excel formula Help for unique rows

    One more question before proceed:

    In rows 37,38 and 39 you have:
    Please Login or Register  to view this content.
    My (first) result returned 1st row (which is wrong, I got it why).
    You write in result table it's 3rd row.

    Why not second?

  34. #34
    Forum Contributor
    Join Date
    01-21-2011
    Location
    London,UK
    MS-Off Ver
    Excel 2007
    Posts
    241

    Re: Vb code or Excel formula Help for unique rows

    Good Morning,
    thanks for being still interested on this .because i done it manually i just choose any row it does not have duplicate from the previous row i choosed,actualynot just row 38and 39
    i can choose from the next atleast 20 rows still would be correct.
    so when you choose a row for next one any string on the red can not be used again;
    Please Login or Register  to view this content.
    i hope it's more clear now..
    thanks again and have a good day.
    sem
    Last edited by sem; 05-29-2011 at 04:54 AM.

  35. #35
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,607

    Re: Vb code or Excel formula Help for unique rows

    ok...
    You'll need a macro, but for now at least we get the point of it

    We have first row which is all unique (1, 1, 1 in D, E, F columns).
    Questions: does it als need to check that all values within each cell are unique?
    For example: 01 02 02 02 etc

    Then in A column next is 2, 36, 1 where 2 and 36 are unique but 1 not (it's already taken from 1,1,1).
    So it go further: 2, 37, 2

    next is 3, 73, 3 (because 3, 71, 1 and 3, 72, 2 are already taken above)...

    Etc...
    Attached Files Attached Files

  36. #36
    Forum Contributor
    Join Date
    01-21-2011
    Location
    London,UK
    MS-Off Ver
    Excel 2007
    Posts
    241

    Red face Re: Vb code or Excel formula Help for unique rows

    Good evening Zbor,
    thanks for still being interested on this,i realy appreciate your help.
    If you go back to my post #22 attachment you'll see in column "E" how many times each string is used in 5775 rows,and also i managed to do 29 correct rows witout duplicate by having helper columns(J:M) to count correctly.as i said before every string or row in colum "E" must be used and only once.
    from the begining i was thinking it needs VB code to solve it,but i might be wrong..
    thank you for being very patience with me.
    sem

  37. #37
    Forum Contributor
    Join Date
    01-21-2011
    Location
    London,UK
    MS-Off Ver
    Excel 2007
    Posts
    241

    Red face Re: Vb code or Excel formula Help for unique rows

    good evening,
    any help on VB code Please.
    sem

  38. #38
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Vb code or Excel formula Help for unique rows

    I suppose you're not residing in London....
    You didn't metion how you got these string, because there's a simple method to produce such unique strings.
    'Filtering' unique items from existing data can be done with

    Please Login or Register  to view this content.
    Last edited by snb; 06-01-2011 at 04:42 AM.



  39. #39
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Vb code or Excel formula Help for unique rows

    My reading was that the result should be presented in 3 columns

    Perhaps this variation on snbs' code
    Please Login or Register  to view this content.
    Test workbook attached
    Attached Files Attached Files
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  40. #40
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,607

    Re: Vb code or Excel formula Help for unique rows

    I don't think it's right because there is no 05 06 07 09 in A column and you got it in E column as 2nd result...

    Als, form the same 2nd result, this shouldn't be answer:
    Please Login or Register  to view this content.
    because there are duplicated 05, 06, 07 and 10. All should be unique (maybe I didn't write it but tha'ts because there is no duplication in original data).

    If I get it corectly.

  41. #41
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Vb code or Excel formula Help for unique rows

    My apologies,
    snbs' code correctly removes all duplicates from the Range A1:C5776, and presents them in one column, however the result is not transferable into columns to suit the request, as I too hastily decided.

    Apologies again.....

  42. #42
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Vb code or Excel formula Help for unique rows

    To me it looks like from the original post the OP is looking for each row where column A changes.... that adds up to 165 as the OP verified.

    So add a helper, in D1:

    =IF(A2=A1,"",COUNT(D$1:D1)+1)

    copied down

    Then formula to get max in F1:

    =MAX(D:D)

    Then in E2 try:

    =IF(ROWS($A$1:$A1)>$F$1,"",INDEX(A:A,MATCH(ROWS($A$1:$A1),$D:$D)))

    copied down as far as necessary and across the next 2 columns.


    P.S. I haven't read through all posts, so not sure if requirement changed. This is based solely on Post #1.
    Attached Files Attached Files
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  43. #43
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Vb code or Excel formula Help for unique rows

    This code will return the each first unique row for the table given in the example.
    Please Login or Register  to view this content.

    I have added a few check formula to the sheet to prove that each number group appears only once in the result, and the row number that the unique set occurs.

    This does not return 165 rows in this case because there are duplicates that occur in B & C, this reduces the number of rows returned and will not return all the unique values found in Column A (165)

    The "Unique Rows" returned will depend on how the data is sorted, in this case it seems to be
    By Column A Then B then C.

    Hope this helps.

    [EDIT]
    This is painfully slow when the proof columns are on the worksheet, once they are deleted it seems okay.
    Attached Files Attached Files
    Last edited by Marcol; 06-01-2011 at 12:59 PM.

  44. #44
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Vb code or Excel formula Help for unique rows

    This might be a formula solution, basically the formula behind the VBa in the previous post.

    In E2
    Please Login or Register  to view this content.
    Drag/Fill Down to the bitter end
    In F2
    Please Login or Register  to view this content.
    Drag over to G2 then Fill Down

    It's a bit slow but it gets there..............zzzzzzzzz

    Then filter the result omitting blanks

    Copy and paste special > values to your desired location
    Attached Files Attached Files
    Last edited by Marcol; 06-01-2011 at 01:24 PM.

  45. #45
    Forum Contributor
    Join Date
    01-21-2011
    Location
    London,UK
    MS-Off Ver
    Excel 2007
    Posts
    241

    Re: Vb code or Excel formula Help for unique rows

    Good Day,(Zbor,SNB,Marcol and NBVC)
    Thank you very very much for all new info.i'm sorry for not responded sooner,i think the best result is Marcol's VB sulotion,its not complete but thats is the nearest to actual result.
    i'm thinkering with result manualy so far just 10 row shorter than actual result.If i manage to solve it i'll keep you posted.
    anyway i can not thank you enough for all this wonderful effort and help.
    Have a nice evening..
    Sem

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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