+ Reply to Thread
Results 1 to 6 of 6

Need help with finding duplicate addresses through an entire workbook and then return valu

Hybrid View

  1. #1
    Registered User
    Join Date
    07-18-2013
    Location
    Irwin, PA
    MS-Off Ver
    Excel 2003
    Posts
    3

    Need help with finding duplicate addresses through an entire workbook and then return valu

    I want to be able to each day add a list of addresses in column A. In column B there will be a date. Each spreadsheet in the workbook will be a different day of the month. I will be adding new address into a new spreadsheet in that workbook as the days tick on.

    What I want to be able to do is for Excel to find a duplicate address and return that address to the first spreadsheet in the workbook along with the corresponding date.

    Can anyone please help with this?

  2. #2
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Need help with finding duplicate addresses through an entire workbook and then return

    So if you type an address on any Sheet that has already been entered it goes to the first entry and changes the date to the current date deleting the newest entry?
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  3. #3
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Need help with finding duplicate addresses through an entire workbook and then return

    Hi redmaneian,
    Could you upload a sample file with your data (if necessary you can change your real data on bananas or oranges)

  4. #4
    Registered User
    Join Date
    07-18-2013
    Location
    Irwin, PA
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Need help with finding duplicate addresses through an entire workbook and then return

    So what I want is to be able to have in the first spreadsheet the duplicate address with corresponding date. I attached a dummy file to give you an idea. In my example it should return the John Doe Inc entry with the dates of 7-1-13 and 7-3-13.

    Please excuse if the format is not correct. Im using openoffice at home but am using Microsoft Excel 2007 at work.
    Attached Files Attached Files

  5. #5
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Need help with finding duplicate addresses through an entire workbook and then return

    try
    Sub ertert()
    Dim x, y(), i&, j&, k&, s$, wsh As Worksheet, ky, sp
    k = 1
    With CreateObject("Scripting.Dictionary")
        .CompareMode = 1
        For Each wsh In ThisWorkbook.Worksheets
            If Not wsh Is ActiveSheet Then
                x = wsh.Range("G2:K" & wsh.Cells(Rows.Count, 7).End(xlUp).Row + 1).Value
                For i = 1 To UBound(x)
                    If Len(x(i, 1)) Then
                        If Not .Exists(x(i, 1)) Then
                            .Item(x(i, 1)) = x(i, 5)
                        Else
                            s = .Item(x(i, 1))
                            If InStr(s, "~") = 0 Then
                                If Not .Exists(s) Then k = k + 1: .Item(s) = k
                            End If
                            If Not .Exists(CStr(x(i, 5))) Then k = k + 1: .Item(CStr(x(i, 5))) = k
                            .Item(x(i, 1)) = s & "~" & x(i, 5)
                        End If
                    End If
                Next i
            End If
        Next wsh
        ReDim y(1 To .Count, 1 To k): y(1, 1) = "DUPLICATE ADDRESS": j = 1
        For i = 2 To k: y(1, i) = "Date " & i - 1: Next i
        For Each ky In .keys
            If InStr(.Item(ky), "~") Then
                j = j + 1: sp = Split(.Item(ky), "~"): y(j, 1) = ky
                For i = 0 To UBound(sp)
                    y(j, .Item(sp(i))) = sp(i)
                Next i
            End If
        Next ky
    End With
    With Range("A1")
        .CurrentRegion.ClearContents: .Resize(j, k).Value = y
    End With
    End Sub
    edited
    I wanted to experiment with If Len(.Item(s)) , but nothing happened.
    I changed the code and replaced the file
    Attached Files Attached Files
    Last edited by nilem; 07-19-2013 at 03:25 AM.

  6. #6
    Registered User
    Join Date
    07-18-2013
    Location
    Irwin, PA
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Need help with finding duplicate addresses through an entire workbook and then return

    Trying to get this to work but so far nothing. It might be because I'm running openoffice. Thank you for the help. I will mess around with this and see if I can get it to work.

+ 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. highlight entire row when finding duplicate value
    By mheinmiller in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-24-2009, 05:07 PM
  2. Duplicate entire workbook
    By JChandler22 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-31-2007, 02:28 AM
  3. finding duplicate addresses
    By diamonds in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-21-2006, 06:40 PM
  4. [SOLVED] Need help finding non-duplicate email addresses...
    By Greg in forum Excel General
    Replies: 15
    Last Post: 03-21-2006, 07:10 PM
  5. Replies: 0
    Last Post: 12-06-2005, 06:35 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