Filter based on list of words

stolie

New Member
Joined
Aug 21, 2004
Messages
33
HI

I have done quite a bit of searching and cant quite find the answer.

I wish to perform a "contains" filter on a column which contains a string of text.

This will be looped using a list of words as the "contains" reference.

The advanced filter doesnt do what i am after.

I realise i can do this in a crude version using mulitples of the below,

ActiveSheet.Range("$A$1:$AA$200").AutoFilter Field:=6, Criteria1:= _
"=word", Operator:=xlAnd

But my list is huge, and surely there is a way to get it to read from a list and fitler accordingly?

Also to paste the corresponding row where the word is found into a new sheet would top it off!

Thanks again
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
HI

I have done quite a bit of searching and cant quite find the answer.

I wish to perform a "contains" filter on a column which contains a string of text.

This will be looped using a list of words as the "contains" reference.

The advanced filter doesnt do what i am after.

I realise i can do this in a crude version using mulitples of the below,

ActiveSheet.Range("$A$1:$AA$200").AutoFilter Field:=6, Criteria1:= _
"=word", Operator:=xlAnd

But my list is huge, and surely there is a way to get it to read from a list and fitler accordingly?

Also to paste the corresponding row where the word is found into a new sheet would top it off!

Thanks again

How large is the list?
 
Upvote 0
stolie,

Are you looking to copy rows of data based on some text into separate worksheets based on the text?

Or, into one workhseet for all the searched text?

You may be able to create an array of the search text and cycle thru and autofilter.


What version of Excel are you using?

You will generally get much more help (and faster) in this forum if you can post your small samples directly in the forum.

Please attach screenshots of your workbook or a sample workbook that accurately portrays your current workbook on one sheet, and what it should look like 'After' on another sheet.

This makes it much easier to see exactly what you want to do, as well as shows us whether there is a consistent number of rows between tables and such.

Here are three possible ways to post small (copyable) screen shots directly in your post:

Please post a screenshot of your sheet(s), what you have and what you expect to achieve, with Excel Jeanie HTML 4 (contains graphic instructions).
http://www.excel-jeanie-html.de/html/hlp_schnell_en.php

or
RichardSchollar’s beta HTML Maker -...his signature block at the bottom of his post

or
Borders-Copy-Paste



If you are not able to give us screenshots:

To get the most precise answer, it is best to upload/attach a sample workbook (sensitive data scrubbed/removed) that contains an example of your raw data on one worksheet, and on another worksheet your desired results.

The structure and data types of the sample workbook must exactly duplicate the real workbook. Include a clear and explicit explanation of your requirements.

You can upload your workbook to www.box.net and provide us with a link to your workbook.
 
Upvote 0
How large is the list?

Does this do you any good, or give you any ideas?

Code:
Sub Stolie()
Dim x As Variant
Dim i As Variant
Dim lr As Long
Dim lr2 As Long

lr = Sheets("Sheet3").Cells(Rows.Count, 1).End(xlUp).Row

With Sheets("Sheet3")

x = Array("WORD1", "WORD2", "WORD3", "WORD4")

For i = LBound(x) To UBound(x)

lr2 = Sheets("Sheet4").Cells(Rows.Count, 1).End(xlUp).Row + 1

    .Range("A2:AA" & lr).AutoFilter Field:=6, Criteria1:=x(i)
    .Range("A2:AA" & lr).EntireRow.SpecialCells(xlCellTypeVisible).Copy Sheets("Sheet4").Range("A" & lr2)
    .Range("A2:AA" & lr).AutoFilter

Next i

End With

End Sub
 
Upvote 0

Forum statistics

Threads
1,224,585
Messages
6,179,696
Members
452,938
Latest member
babeneker

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top