Formula to replace VBA advanced filter

uk747

Well-known Member
Joined
Jul 20, 2011
Messages
832
Office Version
  1. 365
Platform
  1. Windows
Hi

If I have VBA below to do an advanced filter. Was wondering how can I use a filter formula instead

I know I can use individual formulas in L2, M2, N2 etc

But I want the formula to account for values in different cells in the criteria F1:j2 which the below code does. I don't know which cells in the criteria will have value it could be 1 of them 2, 3 or even all 4


VBA Code:
Sheets("sheet1").Range("A1") _
  .CurrentRegion.AdvancedFilter _
    Action:=xlFilterCopy, _
    CriteriaRange:=Sheets("sheet2") _
        .Range("F1:J2"), _
    CopyToRange:=Sheets("sheet2") _
        .Range("L1:P1"), _
    Unique:=False
 
wanted to try and avoid VBA and use a formula instead
 
Upvote 0

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
You don't need VBA for Advanced filter it's on the Data tab.
 
Upvote 0
I know but i wanted to automate it without having to manually do it
 
Upvote 0
I really don't see the point, when all you have to do is click on Reapply or Alt A Y1
 
Upvote 0

Forum statistics

Threads
1,216,499
Messages
6,131,010
Members
449,613
Latest member
MedDash99

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