+ Reply to Thread
Results 1 to 4 of 4

Thread: See if value in a1 appears in b, and if so display b and c

  1. #1
    Registered User
    Join Date
    08-03-2011
    Location
    Norwich
    MS-Off Ver
    Excel 2003
    Posts
    12

    See if value in a1 appears in b, and if so display b and c

    As the title says!

    I have 30000+ records in column a, and over 60000 in column b in column c there is data that is linked with the value of column b.

    Is there anyway to search each instance of a, if it appears in b, display b and c

    This is driving me insane

    Excel 2010

  2. #2
    Forum Guru Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    MS Excel 2010
    Posts
    2,249

    Re: See if value in a1 appears in b, and if so display b and c

    What does 'display b and c mean'? Delete any that do not match, copy them to another sheet? What?

  3. #3
    Registered User
    Join Date
    08-03-2011
    Location
    Norwich
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: See if value in a1 appears in b, and if so display b and c

    Im sorry, copy them to a new sheet would be the ideal goal.

  4. #4
    Forum Guru Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    MS Excel 2010
    Posts
    2,249

    Re: See if value in a1 appears in b, and if so display b and c

    Try this

    Sub CopyMatches()
    Dim rng As Range
    Dim lastrow As Long
        
        Application.ScreenUpdating = False
    
        With ActiveSheet
        
        
            .Copy After:=.Parent.Worksheets(.Parent.Worksheets.Count)
        End With
        
        With ActiveSheet
        
            .Columns("C:C").Insert
            .Range("C1").Value = "temp"
            lastrow = .Cells(.Rows.Count, "A").End(xlUp).Row
            .Range("C2").Resize(lastrow - 1).FormulaR1C1 = "=RC[-2]=RC[-1]"
            Set rng = Range("C1").Resize(lastrow)
            rng.AutoFilter Field:=1, Criteria1:="FALSE"
            Set rng = rng.Offset(1)
            On Error Resume Next
            Set rng = rng.SpecialCells(xlCellTypeVisible)
            On Error GoTo 0
            If Not rng Is Nothing Then rng.EntireRow.Delete
            .Columns("C:C").Delete Shift:=xlToLeft
        End With
        
        Set rng = Nothing
        
        Application.ScreenUpdating = True
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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.2.0