?
Solved

Hi, issue with searching a set of strings in excel

Posted on 2016-10-24
2
Medium Priority
?
48 Views
Last Modified: 2016-11-21
In excel, I have data in column A and I need to search for set of strings in column A. I should get findings in column B.
Ex:
column A                          column B result
Apple                                 no findings
Pen                                    found pen  
pen in the Book               found pen,book
Cat                                     no findings                      
House                                found house
Deer                                   no findings
elephant house               found elephant,house

I need to search pen,book,house,elephant in column A and in corresponding column I have to get found pen,found house.....

I can do this with if condition but the data that I have is huge and so taking lot of time for execution. can this be done with some inbuilt excel functions like search({"pen","house","...},A:A).....????
0
Comment
Question by:sai k
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 52

Accepted Solution

by:
Rgonzo1971 earned 2000 total points
ID: 41858061
Hi,

pls try
Sub macro()
aFind = Split("pen,book,house,elephant", ",")
For Each c In Range(Range("A2"), Range("A" & Rows.Count).End(xlUp))
strFound = ""
    For Each Item In aFind
        If LCase(c) Like "*" & LCase(Item) & "*" Then
            strFound = strFound & "," & Item
        End If
    Next
    If strFound <> "" Then
        c.Offset(, 1) = "found " & Right(strFound, Len(strFound) - 1)
    Else
        c.Offset(, 1) = "no findings"
    End If
Next
End Sub

Open in new window

Regards
0
 
LVL 14

Expert Comment

by:frankhelk
ID: 41895634
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I have recommended this question be closed as follows:

Accept: Rgonzo1971 (https:#a41858061)

If you feel this question should be closed differently, post an objection and the moderators will review all objections and close it as they feel fit. If no one objects, this question will be closed automatically the way described above.

frankhelk
Experts-Exchange Cleanup Volunteer
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question