Advanced Filtering

adambc

Active Member
Joined
Jan 13, 2020
Messages
373
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Can anyone help me work out why this works fine (512 of 1208 records returned) ...

VBA Code:
Sub FilterTest()
   
    ActiveSheet.ListObjects("SharepointUsersTable").Range.AutoFilter Field:=13, _
        Criteria1:="<>"
       
    ActiveSheet.ListObjects("SharepointUsersTable").Range.AutoFilter Field:=1, _
        Criteria1:="FALSE"
   
    ActiveSheet.ListObjects("SharepointUsersTable").Range.AutoFilter Field:=10, _
        Criteria1:="<>"
   
    ActiveSheet.ListObjects("SharepointUsersTable").Range.AutoFilter Field:=33, _
        Criteria1:="="

End Sub

(I know this could be written more elegantly, but I decided to record the macro rather than write it to check if I was doing anything wrong!)

... but this ...

VBA Code:
Sub AdvancedFilter()

    Range("SharepointUsersTable[#All]").AdvancedFilter Action:=xlFilterInPlace, _
        CriteriaRange:=Sheets("Sheet1").Range("A1:D2"), Unique:=False

End Sub

... where Sheets("Sheet1").Range("A1:D2") looks like this ...

1682353344982.png
(I have doubled checked that the table Headers are replicated exactly!)

... returns 0 of 1208 records?

Help please!!!

Thanks ...
 
Last edited:

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Can anyone help me work out why this works fine (512 of 1208 records returned) ...

VBA Code:
Sub FilterTest()
  
    ActiveSheet.ListObjects("SharepointUsersTable").Range.AutoFilter Field:=13, _
        Criteria1:="<>"
      
    ActiveSheet.ListObjects("SharepointUsersTable").Range.AutoFilter Field:=1, _
        Criteria1:="FALSE"
  
    ActiveSheet.ListObjects("SharepointUsersTable").Range.AutoFilter Field:=10, _
        Criteria1:="<>"
  
    ActiveSheet.ListObjects("SharepointUsersTable").Range.AutoFilter Field:=33, _
        Criteria1:="="

End Sub

(I know this could be written more elegantly, but I decided to record the macro rather than write it to check if I was doing anything wrong!)

... but this ...

VBA Code:
Sub AdvancedFilter()

    Range("SharepointUsersTable[#All]").AdvancedFilter Action:=xlFilterInPlace, _
        CriteriaRange:=Sheets("Sheet1").Range("A1:D2"), Unique:=False

End Sub

... where Sheets("Sheet1").Range("A1:D2") looks like this ...

View attachment 90342 (I have doubled checked that the table Headers are replicated exactly!)

... returns 0 of 1208 records?

Help please!!!

Thanks ...
IGNORE!!!

Manual filtering recognises Blanks even though they contain a formula; Advanced Filter doesn't!!!

Need to find a work round (without introducing another (helper) column)!!!
 
Upvote 0
IGNORE!!!

Manual filtering recognises Blanks even though they contain a formula; Advanced Filter doesn't!!!

Need to find a work round (without introducing another (helper) column)!!!
This did the trick!

1682367147435.png
 
Upvote 0
Solution

Forum statistics

Threads
1,215,105
Messages
6,123,118
Members
449,096
Latest member
provoking

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