Search : in
By :

Excel VBA to filter rows containing same word

Last answer on Nov 6, 2009 7:36:50 pm GMT kelee, on Sep 6, 2009 2:26:24 pm BST 
 Report this message to moderators

Hello,

In my Excel there is a column, say, column A, where all the cells are text string such as company names. My task is to filter all the rows where the cells in column A contain the same company names. However, my problem is the company names was originally entered from different sources therefore for the same company it may be entered in different forms, such as for company ABC, it might be entered like ABC CO, ABC PTY LTD, or COMPANY ABC. There are also many other companies entered with the same problem. What I need to do is to find any word in Column A that shows up twice or more and filter all the rows that contains such cells in Column A.

I know this is a very hard task but just wondering if it is possible to do in in VBA? Your help would be greatly appreciated!

Configuration: Windows XP Internet Explorer 7.0

Best answers for « Excel VBA to filter rows containing same word » in :
Excel – Macro to detect and hide blank rows ShowExcel – Macro to detect and hide blank rows Issue Solution Note Issue I want a macro to unhide about 20 blank rows copy values into the top row then hide the remaining rows (some cells have fill though) then the next time it will...
Repainting a cell using excel VBA ShowRepainting a cell using excel VBA Issue Solution Note Issue I am writing a code in excel VBA to generate a report.I am totally new to VBA.Here's my code Private Sub CommandButton1_Click() Dim a1 As Integer Dim d1 As Integer Dim...
How to Create Msg/Popup to notifications in Excel VBA? ShowHow to Create Msg/Popup to notifications in Excel VBA? Issue Solution Note Issue I need a Excel VB script to notify/popup a message when the number of the letter U on a calendar exceeds 6, 8, 12 etc. It will have to check the range of...
Download Ms Word Excel Cracker ShowMs Word Excel Craker allows recover lost or forgotten passwords for .xls and .doc reated with Microsoft Office 97, 2000, 2003, XP or other word and excel compatible programs. This application will be necessary in case you should have received an...

1

venkat1926, on Sep 7, 2009 1:34:41 am BST

Use wildcards

the column A must have column heading in A1
click data=filter-autofilter
click the arrow in column A heading
click custom
left hand side window choose "equal to"
in the right hand side window type
*ABC*
click ok
do you get what you want.
you can copy the filtered data anywhere

to remove filter click again data filter autofitler

* is the sign of wild card
the two * on both sides indicates any other characters or numbers before and after.
wildcards can be used only for some functins in excel

Reply to venkat1926

2

kelee, on Sep 7, 2009 3:41:16 am BST

Hi Vencat1926,

Thanks for your answer to my question. However, "ABC" is only an example in my question, actually there are some other company nams in column A. What I wanted to filter is not just ABC, but all the company names that apprears twice or more in Column A, and I want to filter them at one go, not just to filter them one by one (actually before I do the filter, I will have not idea what word to look up, but just want to find any words that apprear more than once in column A. Is there any way to work this out?

Thanks

Reply to kelee

3

venkat1926, on Sep 7, 2009 11:00:37 am BST

I suppose it can be done by a macro. what you have to do is to extract a list of basic names of the companies in your database and filter and copy one by one by using a macro by automation. . For this you have to post small extract of your database and then one can create the macro.
greetings.

It would be easierr if the main portions of the name (e.g ABC is in the beginning of each name with suffixes.

Reply to venkat1926

4

kelee, on Sep 10, 2009 6:15:11 am BST

Hi,

Below is an example for which I want to filter for the duplicate words.

Company Name
ABC
ABC LTD
ABC CO
IBM
ING ENGINEERING
DDT
MAG ABC
ING CO
MMM
BAG CO
BNN LTD
MMM LTD

Suppose this is Column A, and A1 is the heading "Company Name". The main word I'm looking up is always the first one word in each cell. As you can see, the word "ABC" appears three times in A2, A3 and A4, and "ING" appears twice in A6 & A9, and "MMM" twice on A10 and A13.

Can anyone create a macro that can filter all the above rows which contains a word that appreas twice or more in Column A?

Thanks a lot in advance as this will save me heaps of time and pains for this job as I'm currently doing this with my eyes and I have hundreds of lines to look at each month.

Reply to kelee

5

 Ward, on Nov 6, 2009 7:36:50 pm GMT

I found this on Ozgrid.com - works for me

Sub RemoveDupes()

Columns(1).EntireColumn.Insert 'Add extra Column, "A" becomes "B"
Range("B1", Range("B65536").End(xlUp)).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range("A1"), Unique:=True 'Filter out duplicates and copy unique list to "A"
Columns(2).EntireColumn.Delete 'Add extra Column, "B" becomes "A"

End Sub

Reply to Ward