Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-02-2018, 06:08 AM
gtm1 gtm1 is offline How to find and select multiple items / values at the same time in Excel Windows 10 How to find and select multiple items / values at the same time in Excel Office 2016
Novice
How to find and select multiple items / values at the same time in Excel
 
Join Date: Nov 2018
Posts: 1
gtm1 is on a distinguished road
Default How to find and select multiple items / values at the same time in Excel

Here is an over simplified example of my problem



I have 2 excel spreadsheets.

The first spreadsheet has 1 column with a list of names

John, James, Steve, Richard, Bob

The second spreadsheet also has 1 column with a list of the same names, plus some MORE names.

John, Karl, James, George, Tony, Steve, Mike, Richard, Bob, Chris

I want to find the names in the first spreadsheet, and delete them from the second spreadsheet.. so that the second spreadsheet will be left with

Karl, George, Tony , Mike, Chris

Find and Select lets me do this, but only one at a time. Is there a quicker way to search for multiple names in one go.. as I have around 1000 to check - thanks.
Reply With Quote
  #2  
Old 11-02-2018, 04:07 PM
jeffreybrown jeffreybrown is offline How to find and select multiple items / values at the same time in Excel Windows Vista How to find and select multiple items / values at the same time in Excel Office 2007
Expert
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default

You could do this with a macro! Please test on a copy of your data first.

Code:
Sub Rearrange()
    Dim wsSrc As Worksheet: Set wsSrc = Sheets("Sheet1")
    Dim wsDest As Worksheet: Set wsDest = Sheets("Sheet2")
    Dim lrSrc As Long: lrSrc = wsSrc.Range("A" & Rows.Count).End(xlUp).Row
    Dim lrDest As Long: lrDest = wsDest.Range("A" & Rows.Count).End(xlUp).Row
    
    Const sFormula As String = "=COUNTIF($A$2:$A$#,A2)"
    
    Application.ScreenUpdating = False
    
    wsSrc.Range("A2:A" & lrSrc).Copy wsDest.Range("A" & lrDest + 1)
    
    With wsDest
        .Range("B1").Value = "Hdr"
        lrDest = .Range("A" & Rows.Count).End(xlUp).Row
        With .Range("B2").Resize(lrDest - 1)
            .Formula = Replace(sFormula, "#", lrDest)
            .Value = .Value
        End With
        With .Range("B1", .Range("B" & .Rows.Count).End(xlUp))
            .AutoFilter Field:=1, Criteria1:=">1"
            .Offset(1).EntireRow.Delete
            .AutoFilter
        End With
        .Columns(2).EntireColumn.Delete
    End With

    Application.ScreenUpdating = True
End Sub
Reply With Quote
Reply

Tags
find-and-replace, select, vlookup

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
append multiple time values to date in one column sarahafeez Excel 1 09-25-2017 11:01 PM
Select multiple items from a drop down list ConfuddledOne Excel Programming 0 01-30-2017 08:13 PM
Find and replace multiple values, according to table value - excel formula EtanM Excel Programming 3 04-11-2016 01:43 AM
How to find and select multiple items / values at the same time in Excel How do I find and replace multiple items at once? redzan Word VBA 1 05-16-2013 08:25 AM
How to find and select multiple items / values at the same time in Excel Unable to Select Multiple folders in Outlook 2007 Advance Find gregory Outlook 2 04-28-2012 10:53 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:12 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft