# Autofilter Data based on cell value (drop-down list) in different worksheet

#### jdub84

##### New Member
I'm stuck on this problem. I've created drop-down lists in cells B3 and B4 (this is in worksheet 1), based on a column in Worksheet 2. I'd like Worksheet 2 to autofilter the data based on the drop-downs in B3 or B4, or both together. Can somebody help me write the code?

Thanks for the help - I'm not real experienced with VB.

Last edited:

### Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
It is easy by vba, without vba you have to do some manual exercise.
Add 2 more columns in Worksheet 2, we assume you wish to filter column A of Worksheet 2:
So in Worksheet2, Keep a formula in newly added 1st column like =IF(Sheet1!B3=A3,1,0)
Same way in newly added 2nd column keep formula like IF(Sheet1!B4=A3,1,0)
Copy these formulas till the range of your data.
Now you can filter newly added 2 columns either both with 1 or any one with 1.

I hope this will solve your problem.

Regards,

Mati

Thank you for your reply. I would like to autofilter column K in Worksheet 2, based on the input values from the drop-downs in B3 and B4 in Worksheet 1. I would rather use the VBA code so I can set up a button and run the macro just by clicking.

Replies
3
Views
73
Replies
17
Views
213
Replies
2
Views
194
Replies
6
Views
181
Replies
2
Views
122

1,218,560
Messages
6,143,200
Members
450,469
Latest member
brent3162

### 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.

### Which adblocker are you using?

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

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