I have a spreadsheet with about 30000 rows in it.  One of the columns in the spreadsheet has comments from our employees to document communications with our customers.  I need to create a new spreadsheet with all of the columns for all rows where column E contains any of the following:  price, cost, margin, percent, match, competitive, quote.  I am stumped on how to do this.  I basically want to say show me rows that column E contains the word price or cost or margin or percent or match or competitive or quote.

How can I do this?
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Process Improvement MgrCommented:
You could do it with power pivot. You could also apply table formatting which gives you filter rows
0
Commented:
One way that I've done things like this is to add a new column that searched for the requested matches, then filter on that column.

For example, if the source data is in column A, insert column B with a formula like this:

=IF(NOT(ISERR(FIND("price",A1))),1,     IF(NOT(ISERR(FIND("cost",A1))),1,   0)   )

Replace the last "0" with additional IF's for each word.
Any formula that returns a non-zero will contain at least one of the words.  Filter on non-zeros and you have your list.

However, given the complexity of that, it might be easier to user a VBA function to do all that work for you and your formulas will look much better, like =HASMATCHINGWORD(A1)
0

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Author Commented:
Perfect.
0
Excel VBA DeveloperCommented:
You could also use VBA to create a user-defined function that would let you know if any one of a select group of key words appeared in the comments column.
``````Function Find_Matches(Test_Cell As Range, Lookup_array As Range) As String
Dim cl As Object
For Each cl In Lookup_array
If InStr(1, Test_Cell, cl.Value, vbTextCompare) > 0 Then
Find_Matches = Find_Matches & cl.Value & ", "
End If
Next cl
If Find_Matches <> "" Then
Find_Matches = Left(Find_Matches, Len(Find_Matches) - 2)
Else
End If
End Function
``````

You add this function to a new module in your workbook (VBA Project).

Then, create a list of target words that you want to search for (I recommend a table on another sheet). Then, add a new column adjacent to your data and insert the following formula:
=Find_Matches(test_value,search_range)
where
test_value is the comment cell you want to test
search_range is the range of cells containing the target words.

For example, I put a list of your words on a new sheet called "Words" in cells A2:A8.  If the comments are in column E, then add this formula in column F (cell F2, and copy down)
=Find_Matches(E2,Words!\$A\$2:\$A\$8)

Any and all matching words will be displayed in this cell (even more than one), otherwise it will display "NOT FOUND".  You can then turn on filtering and uncheck the "NOT FOUND" results to see all your relevant data.

Example file attached.

Regards,
-Glenn
EE-FindMatches2.xlsm
0
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.