Searching multiple columns and hide rows

Blanchetdb

Board Regular
Joined
Jul 31, 2018
Messages
167
Office Version
  1. 365
Platform
  1. Windows
I presently working with a google docs form (can not change that form as it is used by multiple departments). The data is exported to an excel form that gives me the following:

First NameLast NameLanguageProvince (choice 1)Province (Choice 2)City (Choice 1)City (Choice 2)Specialization 1Specialization 2Specialization 3
Jane DoeFrenchNew BrunswickNova ScotiaHalifaxMonctonEnvironmentScience
John SmithEnglishQuebecOntarioMontrealTorontoScienceAdministrationEnvironment
FredTimmonsEnglishManitobaNew BrunswickWinnipegMonctonScience

I need a way to quickly search throughout the document (it presently has 600 rows) and there are more options than shown but this is a sample.

I would like to able to use a drop menu for Province, City and Specialization in order to choose what I am seeking.... what does not match all requirements, the row hides - leaving only (visible) the rows that meet what has been chosen.

example:
Province: Ontario / City: Toronto / Specialization: Science
RESULT:
JohnSmithEnglishQuebecOntarioMontrealTorontoScienceAdministrationEnvironment

All other "no match" are not visible .... If there are no match ... a message box appears stating " No results found"
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
You would need to have a list of cities, provinces and specializations (perhaps on a different sheet) to populate the drop down menus. Where do you want the drop down menus?
 
Upvote 0
You would need to have a list of cities, provinces and specializations (perhaps on a different sheet) to populate the drop down menus. Where do you want the drop down menus?
I do have a separate sheet that have all the dropdown options. Ultimately, it would be great if the drop down menus would be on a separate sheet but trigger the hide/show on the main raw data sheet
 
Upvote 0
What are the names of the Data sheet and the sheet with the drop down options? In which columns are the cities, provinces and specializations?
 
Upvote 0
What are the names of the Data sheet and the sheet with the drop down options? In which columns are the cities, provinces and specializations?
Raw Data sheet is called - Recruitment
Drop options list is called - List
Sheet that would contain the dropdown boxes - Referral

I gave you an abbreviated version of the data sheet that I get as the data goes from column A to CN.... there are 3 columns for Provinces, 3 for Cities, 3 for specializations ... I can adapt what you are able to provide to fit the proper columns.

thank you for your time on this
 
Upvote 0
Click here to download a sample file. In the Referral sheet, first select a province, then a city and lastly a Specialization. The macro runs automatically when you select a Specialization so it is important that it be selected last. The code is located in the worksheet code module. To see the code, right click the tab name for your Referral sheet and click 'View Code'. Close the code window to return to your sheet. This is the code:
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address(0, 0) <> "C2" Then Exit Sub
    Application.ScreenUpdating = False
    Dim srcWS As Worksheet, v As Variant, i As Long, fnd As Range
    Set srcWS = Sheets("Recruitment")
    v = srcWS.Range("A2", srcWS.Range("A" & Rows.Count).End(xlUp))
    For i = UBound(v) To LBound(v) Step -1
        Set fnd = srcWS.Rows(i + 1).Find(Target.Value, LookIn:=xlValues, lookat:=xlWhole)
        If fnd Is Nothing Then
            srcWS.Rows(i + 1).Hidden = True
        Else
            Set fnd = srcWS.Rows(i + 1).Find(Target.Offset(, -1).Value, LookIn:=xlValues, lookat:=xlWhole)
            If fnd Is Nothing Then
                srcWS.Rows(i + 1).Hidden = True
            Else
                Set fnd = srcWS.Rows(i + 1).Find(Target.Offset(, -2).Value, LookIn:=xlValues, lookat:=xlWhole)
                If fnd Is Nothing Then
                    srcWS.Rows(i + 1).Hidden = True
                End If
            End If
        End If
    Next i
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
I forgot to mention that you can change the lists and the drop downs will adjust automatically.
 
Upvote 0

Forum statistics

Threads
1,226,017
Messages
6,188,441
Members
453,474
Latest member
th9r

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