Results 1 to 27 of 27

Exclude data conflicts and then match remaining Data

Threaded View

Lee_of_Excel Exclude data conflicts and... 09-01-2020, 09:03 PM
Lee_of_Excel Re: Exclude data conflicts... 09-02-2020, 09:31 PM
jindon Re: Exclude data conflicts... 09-02-2020, 10:44 PM
Lee_of_Excel Re: Exclude data conflicts... 09-02-2020, 10:59 PM
jindon Re: Exclude data conflicts... 09-02-2020, 11:15 PM
Lee_of_Excel Re: Exclude data conflicts... 09-02-2020, 11:24 PM
jindon Re: Exclude data conflicts... 09-02-2020, 11:28 PM
Lee_of_Excel Re: Exclude data conflicts... 09-02-2020, 11:41 PM
Lee_of_Excel Re: Exclude data conflicts... 09-02-2020, 11:32 PM
jindon Re: Exclude data conflicts... 09-02-2020, 11:39 PM
Lee_of_Excel Re: Exclude data conflicts... 09-02-2020, 11:46 PM
jindon Re: Exclude data conflicts... 09-03-2020, 05:33 AM
Lee_of_Excel Re: Exclude data conflicts... 09-03-2020, 05:59 AM
jindon Re: Exclude data conflicts... 09-03-2020, 06:03 AM
Lee_of_Excel Re: Exclude data conflicts... 09-03-2020, 07:09 AM
jindon Re: Exclude data conflicts... 09-03-2020, 07:30 AM
Lee_of_Excel Re: Exclude data conflicts... 09-03-2020, 07:44 AM
Lee_of_Excel Re: Exclude data conflicts... 09-03-2020, 08:28 PM
jindon Re: Exclude data conflicts... 09-03-2020, 08:51 PM
Lee_of_Excel Re: Exclude data conflicts... 09-03-2020, 10:01 PM
jindon Re: Exclude data conflicts... 09-03-2020, 10:06 PM
Lee_of_Excel Re: Exclude data conflicts... 09-03-2020, 10:12 PM
jindon Re: Exclude data conflicts... 09-03-2020, 10:22 PM
Lee_of_Excel Re: Exclude data conflicts... 09-03-2020, 10:38 PM
jindon Re: Exclude data conflicts... 09-03-2020, 10:45 PM
Lee_of_Excel Re: Exclude data conflicts... 09-03-2020, 11:00 PM
Lee_of_Excel Re: Exclude data conflicts... 09-04-2020, 02:39 AM
  1. #16
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Exclude data conflicts and then match remaining Data

    This is to test the results if the logic is correct or not, so still need more error trap.
    Sub test()
        Dim a, b, x, i As Long, ii As Long, rngSite As Range
        Dim myCols(), n As Long, myS, temp, t As Long
        Set rngSite = Sheets("SITE_TABLE").Cells(1).CurrentRegion
        With Sheets("matching").Cells(1).CurrentRegion
            t = Application.Match("output field", .Rows(1), 0)
            For ii = 1 To t - 1
                If .Cells(1, ii).Address = .Cells(1, ii).MergeArea(1).Address Then
                    n = n + 1: ReDim Preserve myCols(1 To 2, 1 To n)
                    myCols(1, n) = ii: myCols(2, n) = .Cells(1, ii).MergeArea.Count + ii - 1
                End If
            Next
            a = .Resize(, t - 1).Value
            .Columns(t).Offset(2).Resize(, 100).ClearContents
            b = .Columns(t).Resize(, 100).Value
            For i = 3 To UBound(a, 1)
                ReDim myS(1 To myCols(2, 2) - myCols(2, 1) + 1)
                For ii = myCols(1, 2) To myCols(2, 2)
                    If a(i, ii) <> "" Then myS(ii) = a(i, ii)
                Next
                For ii = myCols(1, 3) To myCols(2, 3)
                    If a(i, ii) <> "" Then
                        x = Application.VLookup(a(i, ii), rngSite, 2, False)
                        ReDim Preserve myS(1 To UBound(myS) + 1)
                        myS(UBound(myS)) = x
                    End If
                Next
                n = 0
                For ii = myCols(1, 4) To myCols(2, 4)
                    If a(i, ii) <> "" Then
                        x = Application.VLookup(a(i, ii), rngSite, 2, False)
                        If x <> "" Then
                            If IsError(Application.Match(x, myS, 0)) Then
                                n = n + 1: b(i, n) = a(i, ii)
                            End If
                        Else
                            n = n + 1: b(i, n) = a(i, ii) & " (No Match)"
                        End If
                    End If
                Next
            Next
            .Columns(t).Resize(, UBound(b, 2)).Value = b
        End With
    End Sub
    Last edited by jindon; 09-03-2020 at 07:55 AM. Reason: Found a bug and fixed.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. how to eliminate certain data from the worksheet and then sort the remaining data
    By sumesh56 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-20-2018, 12:13 PM
  2. Macro to clear row data then shift remaining data up to empty rows.
    By clarmech in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-15-2014, 04:35 PM
  3. Exclude items from Data Validation List based on another columns data
    By amartin575 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-19-2013, 11:53 AM
  4. Index/match or Vlookup to exclude data
    By MZing81 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-21-2012, 03:32 PM
  5. How to find match data and exclude with condition
    By buvan in forum Excel General
    Replies: 2
    Last Post: 11-17-2011, 06:51 AM
  6. exclude a match condition between two data fields
    By rhiekel in forum Excel General
    Replies: 6
    Last Post: 04-22-2011, 10:53 AM
  7. [SOLVED] Adding data to celss but keeping the remaining data intact.
    By TP in forum Excel General
    Replies: 4
    Last Post: 04-12-2006, 09:20 PM

Tags for this Thread

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