Forum Discussion
How do I find multiple search terms in Excel?
I often need to search a large list of search terms in an Excel sheet, but the search function is too tedious to do because I have to search for them individually. How do I search for these faster? I don't need to search a specific column or columns, just the entire sheet is fine. The list of search terms I get are not in any particular format, usually just a list typed up in Microsoft word or in PDF format, but I am able to copy and paste them. I'm normally using Excel for Android, free version, but also have a laptop with Office 2010.
AbtinS I see my code only looks for cells which contain just the word you are looking for. This adjusted version looks for cells containing the words:
Option Explicit Sub ListHits() Dim Cell2Find As Range Dim FoundCell As Range Dim FirstFound As Range Dim Ct As Long Dim KeepLooking As Boolean For Each Cell2Find In Worksheets("Keywords").UsedRange If Len(Cell2Find.Value) > 0 Then Set FirstFound = Nothing With Worksheets("Data") Ct = 0 Set FoundCell = Nothing Set FoundCell = .UsedRange.Find(What:=Cell2Find.Value, After:=.Range("A1"), LookIn:=xlValues, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False) If FoundCell Is Nothing Then KeepLooking = False Else Set FirstFound = FoundCell KeepLooking = True End If Do While KeepLooking Ct = Ct + 1 Cell2Find.Offset(, Ct).Hyperlinks.Add Cell2Find.Offset(, Ct), "", FoundCell.Address(external:=True), FoundCell.Address(external:=True) 'Set FoundCell = Nothing Set FoundCell = .UsedRange.FindNext(FoundCell) If FoundCell Is Nothing Then KeepLooking = False If FoundCell.Address = FirstFound.Address Then KeepLooking = False Loop End With End If Next End Sub
22 Replies
- Optin44Copper Contributor
AbtinS If i may jump-on this past chain and ask anyone about a simpler question... I have large national databases of clients, and we need to identify a handful of zip codes, and again, entering each one by one to search is ridiculous.
I'm not an excel guru, and have searched the basics on line, however no success trying figure this out.
This seems like it would be an easy formula, as example, enter 10 zip codes at once > then searches the sheet?
Please, I welcome any advise or assistance, Thank You!
- wumoladIron ContributorI believe you should be able to achieve this with a simple lookup formula.
- wumoladIron Contributor
AbtinS do you mean there is a list of words to search for in a particular column? if so, you can look at this video. https://www.youtube.com/watch?v=D7vj7J7crB0
if this is not the situation, you can share some sample data to understand your question better.
- AbtinSCopper ContributorThat video didn't apply to what I need. Basically I have a sheet with several columns, and many rows. Most of what I need to search for are names that are in 2 or 3 particular columns, but would preferably like to search the entire sheet. In addition, I have many search terms in a list, let's say a list in a word doc, in a format like this:
John Doe
Coke
Apple
etc.
I'm looking for a way to copy and paste that list into Excel and find out if I got a hit on any of the words, and if so where the hit is.
- JKPieterseSilver ContributorCan you perhaps upload a sample file with some (anonymous) data?
- AbtinSCopper Contributor
I tried to explain it again above if that helps. If not I can see if I can create a sample file.
- JKPieterseSilver Contributor