Issue with Filtering

fv1399

New Member
Joined
Dec 18, 2019
Messages
6
Office Version
  1. 2016
Platform
  1. Windows
  2. MacOS
Hello forum,

Basically I have a questionnaire (Button) that allows me to filter the room and it shows everyone in the room. Is there a way that once I filter the room and then filter the people in the room without loosing the room filter.

Example:
If I filter by Room 2, I will see Designer, Engineer and Doctor.
Then if I filter by Doctor, I will see doctors from all rooms. What I need is keeping the filter of room 2 and filtering doctors out of room 2 only. I want to be able to filter both of them at the same time. Please help!!
Capture.JPG
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Welcome to the board!

It is not possible to do it at the same time.
You could run a macro, the macro filters through one column and then through the other column, but even for the macro it would have to be done in 2 steps, you would see only one step.
The other option is to create an auxiliary column, concatenate the 2 columns and filter in that auxiliary column.
 
Upvote 0
How about this.

VBA Code:
Sub FILTERROOM()
With Range("A1:C" & Range("A" & Rows.Count).End(xlUp).Row)
    .AutoFilter Field:=1, Criteria1:="2"
    .AutoFilter Field:=2, Criteria1:="Doctor"
End With
End Sub
 
Upvote 0
Welcome to the board!

It is not possible to do it at the same time.
You could run a macro, the macro filters through one column and then through the other column, but even for the macro it would have to be done in 2 steps, you would see only one step.
The other option is to create an auxiliary column, concatenate the 2 columns and filter in that auxiliary column.

I didn't understand the auxiliary column part. Can you please elaborate it?
 
Upvote 0
How about this.

VBA Code:
Sub FILTERROOM()
With Range("A1:C" & Range("A" & Rows.Count).End(xlUp).Row)
    .AutoFilter Field:=1, Criteria1:="2"
    .AutoFilter Field:=2, Criteria1:="Doctor"
End With
End Sub
Hi
VBA Code:
Sub FILTERROOM()

With Range("A1:C" & Range("A" & Rows.Count).End(xlUp).Row)

    .AutoFilter Field:=1, Criteria1:="2"

    .AutoFilter Field:=2, Criteria1:="Doctor"

End With

End Sub

How do I generalize this code for the entire sheet.
How do I say if I filter by room number and if I filter by who is in the room, how can I lock my 1st filter (Filter by room number)??
 
Upvote 0
Hello forum,

Basically I have a questionnaire (Button) that allows me to filter the room and it shows everyone in the room. Is there a way that once I filter the room and then filter the people in the room without loosing the room filter.

Example:
If I filter by Room 2, I will see Designer, Engineer and Doctor.
Then if I filter by Doctor, I will see doctors from all rooms. What I need is keeping the filter of room 2 and filtering doctors out of room 2 only. I want to be able to filter both of them at the same time. Please help!!
View attachment 2361

Hi,

Not sure if I understand you correctly but I think I use exactly the same thing on my spreadsheet for phone make, colour and network.

First highlight the row with your headings. Then click filter. Then you can drop down so that Room # is ticked "2". Once you have filtered to this, you can then click the arrow by "WHO" and click Doctor. This will then just keep the data for doctors in room 2 (I presume this is what you're after).

Apologies if I've misunderstood!
 
Upvote 0
Hi,

Not sure if I understand you correctly but I think I use exactly the same thing on my spreadsheet for phone make, colour and network.

First highlight the row with your headings. Then click filter. Then you can drop down so that Room # is ticked "2". Once you have filtered to this, you can then click the arrow by "WHO" and click Doctor. This will then just keep the data for doctors in room 2 (I presume this is what you're after).

Apologies if I've misunderstood!
I may have explained the issue incorrectly.

I have a questionnare that lets me choose between rooms. If I chose room 1 , it will show me all the doctors and engineers in room 1.
I want to be able to filter between doctors, engineers and designers without the room getting changed.

So I choose room 1, it will show me all the doctors and engineers in room 1. Next, if I filter by Doctors, the sheet would show me doctors in all of the rooms. not just room 2.

Does this give a better picture of my problem?
 
Upvote 0
Hi, I don't think I fully understand I'm sorry. If the questionnaire is purely within Excel and you can answer by clicking the drop downs then my solution should work (I have built your data into a worksheet and can filter so it shows: Room #2, WHO Doctor, Hidden 1.)
 
Upvote 0
Upvote 0

Forum statistics

Threads
1,216,041
Messages
6,128,467
Members
449,455
Latest member
jesski

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