Solved

Posted on 2014-09-05
266 Views
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?
0
Question by:9thTee
[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

LVL 19

Expert Comment

ID: 40306172
You could do it with power pivot. You could also apply table formatting which gives you filter rows
0

LVL 22

Accepted Solution

rspahitz earned 500 total points
ID: 40306193
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

Author Closing Comment

ID: 40306438
Perfect.
0

LVL 27

Expert Comment

ID: 40306558
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

## Featured Post

Question has a verified solution.

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

This article will show, step by step, how to integrate R code into a R Sweave document
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
###### Suggested Courses
Course of the Month8 days, 14 hours left to enroll