Solved

Hi, issue with searching a set of strings in excel

Posted on 2016-10-24
2
17 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
2 Comments
 
LVL 48

Accepted Solution

by:
Rgonzo1971 earned 500 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 13

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

705 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now