+ Reply to Thread
Results 1 to 40 of 40

Want to separate unique and duplicate data from large data base

  1. #1
    Registered User
    Join Date
    07-25-2014
    Location
    pune
    MS-Off Ver
    win7
    Posts
    22

    Want to separate unique and duplicate data from large data base

    Hi i want to separate unique and duplicate data from my data base. But it must be check two different condition and then separate the data .
    e.g. if i have customer data where i have customer name, address, pincode. here macro can check customer name first and if macro find same name then macro check his address also if both name and address is same then only he can cut data and past to other sheet.
    please find attached sheet for your reference.
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Want to separate unique and duplicate data from large data base

    try
    Please Login or Register  to view this content.

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Want to separate unique and duplicate data from large data base

    Hi sambha and welcome the forum,

    See the attached with two helper columns. See if this gets you closer to your answer.
    Attached Files Attached Files
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Registered User
    Join Date
    07-25-2014
    Location
    pune
    MS-Off Ver
    win7
    Posts
    22

    Re: Want to separate unique and duplicate data from large data base

    Thanks a lot,
    this work .......
    but i want to shift duplicate data on new sheet.
    please help me on this issue

    thanks in advance...

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Want to separate unique and duplicate data from large data base

    If you are talking to me
    change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    07-25-2014
    Location
    pune
    MS-Off Ver
    win7
    Posts
    22

    Re: Want to separate unique and duplicate data from large data base

    Hi Jindon,
    please find attached file i have data in that format and want to separate duplicate on new sheet i was tried the changes which you suggest.
    i used command button for that. please use attached sheet and help me to create unique data
    Attached Files Attached Files

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Want to separate unique and duplicate data from large data base

    Col.L,M & N makes address
    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    08-17-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    132

    Re: Want to separate unique and duplicate data from large data base

    Hi Jindon,

    Could you please add comments for my understanding?

    Regards,

  9. #9
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Want to separate unique and duplicate data from large data base

    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    08-17-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    132

    Re: Want to separate unique and duplicate data from large data base

    Thanks Jindon. Would you mind telling me the best link to learn Dictionary object..

    You deserve Rep+..

    Regards,

  11. #11
    Registered User
    Join Date
    07-25-2014
    Location
    pune
    MS-Off Ver
    win7
    Posts
    22

    Re: Want to separate unique and duplicate data from large data base

    Thanks Jindon,
    thanks a lot for your help,i want your little more help regarding this macro.
    i create one button for this macro and i put this code for this button and work also but now i want to do some changes in it .i want to make it more user friendly , macro will ask user to input column no. or on which field user want(field can 1 or more) to find duplication
    please find attached file for your reference
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    07-25-2014
    Location
    pune
    MS-Off Ver
    win7
    Posts
    22

    Re: Want to separate unique and duplicate data from large data base

    in short we have to create one small form for it . or tell me other solution for it

  13. #13
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Want to separate unique and duplicate data from large data base

    Quote Originally Posted by sambha View Post
    in short we have to create one small form for it . or tell me other solution for it
    It's your choice.
    If you go with userform, prepare it and attach it to your file.

  14. #14
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Want to separate unique and duplicate data from large data base

    And tell me the reason for having blank column in Col.I.

    It is a very poor data structure to have blank Rows/Columns within a data range.

  15. #15
    Registered User
    Join Date
    07-25-2014
    Location
    pune
    MS-Off Ver
    win7
    Posts
    22

    Re: Want to separate unique and duplicate data from large data base

    Dear Jindon,
    i delete that column to make file size small . original file size is upto 11BM

  16. #16
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Want to separate unique and duplicate data from large data base

    That doesn't answer to my question.

    Anyway w/o userform
    Attached Files Attached Files

  17. #17
    Registered User
    Join Date
    07-25-2014
    Location
    pune
    MS-Off Ver
    win7
    Posts
    22

    Re: Want to separate unique and duplicate data from large data base

    Thanks Jindon.
    you truly deserve respect .
    thanks a lot...

  18. #18
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Want to separate unique and duplicate data from large data base

    If this solved your problem, you should mark the thread as "Solved".

  19. #19
    Registered User
    Join Date
    07-25-2014
    Location
    pune
    MS-Off Ver
    win7
    Posts
    22

    Re: Want to separate unique and duplicate data from large data base

    thank everyone and specially Jindon,
    my problem is solve now...

  20. #20
    Registered User
    Join Date
    07-25-2014
    Location
    pune
    MS-Off Ver
    win7
    Posts
    22

    Re: Want to separate unique and duplicate data from large data base

    Hi Jindon
    when i try this on other data it remove just few duplicates not all,
    i already checked all spelling ,any extra space or char have included in it but nothing like that. and also when i used your old macro it work and give me all duplicates

  21. #21
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Want to separate unique and duplicate data from large data base

    No idea about what you are talking about.

  22. #22
    Registered User
    Join Date
    07-25-2014
    Location
    pune
    MS-Off Ver
    win7
    Posts
    22

    Re: Want to separate unique and duplicate data from large data base

    Dear Jindon,
    Macro is not accepting user input. Macro still work on the column (name, add1,add2,add3).
    please check red text.

    Sub test()
    Dim a, i As Long, ii As Long, txt As String
    Dim n As Long, e, dic As Object, rng As Range, r As Range
    Set dic = CreateObject("Scripting.Dictionary")
    dic.CompareMode = 1
    On Error Resume Next
    Set rng = Application.InputBox("Select header(s)" & vbLf & _
    "If multiple cells, holding down Ctl key and select", Type:=8)
    On Error GoTo 0
    If rng Is Nothing Then Exit Sub
    With Sheets("sheet1")
    With .Range("a1", .Cells.SpecialCells(11))
    a = .Value
    .ClearContents
    For i = 1 To UBound(a, 1)
    For Each r In rng
    txt = txt & Chr(2) & a(i, r.Column)
    Next
    txt = Join(Array(a(i, 4), a(i, 12), a(i, 13), a(i, 14)), Chr(2))
    If Not dic.exists(txt) Then
    n = n + 1: dic(txt) = Empty
    For ii = 1 To UBound(a, 2)
    a(n, ii) = a(i, ii)
    Next
    Else
    dic(txt) = Application.Index(a, i, 0)
    End If
    txt = ""
    Next
    For Each e In dic.keys
    If Not IsArray(dic(e)) Then dic.Remove e
    Next
    .Resize(n).Value = a
    With Sheets.Add.Cells(1).Resize(, .Columns.Count + 1)
    If dic.Count Then
    .Resize(dic.Count).Value = Application.Index(dic.items, 0, 0)
    End If
    End With
    End With
    End With
    End Sub

  23. #23
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Want to separate unique and duplicate data from large data base

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)

  24. #24
    Registered User
    Join Date
    07-25-2014
    Location
    pune
    MS-Off Ver
    win7
    Posts
    22

    Re: Want to separate unique and duplicate data from large data base

    Dear Jindon,
    Macro is not accepting user input. Macro still work on the column (name, add1,add2,add3).i.e. 4,12,13,14 column
    please check red text.


    Please Login or Register  to view this content.

  25. #25
    Registered User
    Join Date
    07-25-2014
    Location
    pune
    MS-Off Ver
    win7
    Posts
    22

    Re: Want to separate unique and duplicate data from large data base

    Dear Jindon ,
    Please help me .......

  26. #26
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Want to separate unique and duplicate data from large data base

    I can not help you unless I see your actual file.

    It is not the code, but your data layouts I guess.

  27. #27
    Registered User
    Join Date
    07-25-2014
    Location
    pune
    MS-Off Ver
    win7
    Posts
    22

    Re: Want to separate unique and duplicate data from large data base

    hi jindon,
    please find attached my actual data file...
    please help me to sort data by accepting user input(user choice column)
    Attached Files Attached Files

  28. #28
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Want to separate unique and duplicate data from large data base

    Which column(s) did you select as a unique key?

  29. #29
    Registered User
    Join Date
    07-25-2014
    Location
    pune
    MS-Off Ver
    win7
    Posts
    22

    Re: Want to separate unique and duplicate data from large data base

    Hi Jindon,
    unique key is depend on user. User must have rights to choose column(s) as unique key. Mostly name , address and mobile number we are considering as the unique key, but column selection and combination is depends on user.

  30. #30
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Want to separate unique and duplicate data from large data base

    Then I must say it is working as I programmed, end of the story.

  31. #31
    Registered User
    Join Date
    07-25-2014
    Location
    pune
    MS-Off Ver
    win7
    Posts
    22

    Re: Want to separate unique and duplicate data from large data base

    Hi Jindon,
    If code is working as per user choice input then why you use below code ?
    and if i use column 4 (name )as user input it must show me 28 duplicates but it shows only 3 duplicate instead of 28. please use my last data file which i sent you. please use macro on it and see the result you will get every time only 3 duplication.

    Please Login or Register  to view this content.
    please check data file i highlighted duplicates in yellow color.
    Attached Files Attached Files

  32. #32
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Want to separate unique and duplicate data from large data base

    Just delete that line.

    That is the line I missed to delete, due to your request has been changing.

  33. #33
    Registered User
    Join Date
    07-25-2014
    Location
    pune
    MS-Off Ver
    win7
    Posts
    22

    Re: Want to separate unique and duplicate data from large data base

    Thanks Jindon,
    it working great, only last thing i want to add
    please find below example .

    i.e. Mr. ABC have 4 entry in data if i use macro it shows 1 entry in unique data and 1 entry in duplication(3 entry must be seen in duplicates)
    thats why i m not able to match my unique and duplicate data.

    please help me on this last point

  34. #34
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Want to separate unique and duplicate data from large data base

    Please Login or Register  to view this content.

  35. #35
    Registered User
    Join Date
    07-25-2014
    Location
    pune
    MS-Off Ver
    win7
    Posts
    22

    Re: Want to separate unique and duplicate data from large data base

    hii jindon,
    macro works but macro remove all duplicate data and paste to new sheet .
    macro must be left 1st record in unique data and shift other in new sheet.
    e.g abc have 4 entry then 1 must be in unique and other 3 in new sheet where is duplicate data is transferred. macro move all 4 entry to new sheet

  36. #36
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Want to separate unique and duplicate data from large data base

    Please Login or Register  to view this content.

  37. #37
    Registered User
    Join Date
    07-25-2014
    Location
    pune
    MS-Off Ver
    win7
    Posts
    22

    Re: Want to separate unique and duplicate data from large data base

    Hi Jindon,
    yu are too good and very kind and respected person..
    can ihave your Mail Id, I want to connect with you to learn more about macro....
    please share your mail id or facebook id

  38. #38
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Want to separate unique and duplicate data from large data base

    You should mark the thread as "Solved".

  39. #39
    Registered User
    Join Date
    07-25-2014
    Location
    pune
    MS-Off Ver
    win7
    Posts
    22

    Re: Want to separate unique and duplicate data from large data base

    My problem has solve ........
    But column header is also moved to new sheet.
    My column header must remain in main sheet also paste to new sheet. Is it possible ?
    Last edited by sambha; 08-01-2014 at 11:50 PM.

  40. #40
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Want to separate unique and duplicate data from large data base

    Please Login or Register  to view this content.

    Please Login or Register  to view this content.
    To mark the thread as "SOLVED", select Thread Tools from the menu link above and mark this thread as SOLVED.

+ 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. Replies: 8
    Last Post: 11-25-2013, 10:26 PM
  2. Help Creating a List from a large data base with repeating information
    By KelliB in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-17-2013, 04:09 PM
  3. Updating data in 2 different speadsheet Base on unique User ID
    By snsavidg in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-16-2012, 03:38 PM
  4. Replies: 2
    Last Post: 11-09-2007, 03:05 PM
  5. Replies: 5
    Last Post: 03-19-2006, 02:26 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