Filter multiple columns for a single word

oceanorigami

New Member
Joined
Feb 28, 2014
Messages
7
I want to run a filter "contains" RND on multiple columns but can't figure out how to do it. I think I need to use a macro or the Advanced Filter. Can anyone help explain how to do it?
 
Welcome to the MrExcel board!

Is this what you mean? If not, I suggest that you start a new thread and detail your exact requirements. You could add a link to this thread if you think it would be useful to your potential helpers.

I have assumed that column Z is available to use as helper column for the Advanced Filter.

VBA Code:
Sub Show_My_Rows_of_Interest()
  Dim rCrit As Range
 
  Const TextOfInterest As String = "RND"
  Const ColsOfInterest As String = "F:N"
 
  Application.ScreenUpdating = False
  Application.DisplayAlerts = False
  With ActiveSheet
    On Error Resume Next
    .ShowAllData
    On Error GoTo 0
    Set rCrit = .Range("Z1:Z2")
    With Intersect(.UsedRange, .Columns(ColsOfInterest))
      rCrit.Cells(2).Formula = Replace(Replace("=COUNTIF(#,""*%*"")", "#", .Rows(2).Address(0, 0)), "%", TextOfInterest)
      .AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:=rCrit, Unique:=False
    End With
    rCrit.Cells(2).ClearContents
  End With
  Application.ScreenUpdating = True
  Application.DisplayAlerts = True
End Sub

Thank you so much @Peter_SSs , this was exactly what i meant and it worked perfectly! :)
Can I also ask if it possible to do this for more than one word at the time? Using the example of this thread it would be if I want to filter for both "RND" and "sold" within the limits you wrote above.

Thank you in advance!
 
Upvote 0

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Forum statistics

Threads
1,216,112
Messages
6,128,901
Members
449,477
Latest member
panjongshing

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