Results 1 to 10 of 51

Thread: VBA - Count filtered rows in the table

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    10,457
    Rep Power
    10
    Hallo

    I am getting some different results to yours… I don’t understand yet why

    Example:

    Your results:
    Count
    Total rows: 100
    Name filter: 80 Left / Filtered 20
    Region filter: 72 Left / Filtered 8
    Country filter: 64 Left / Filtered 8
    Fname= rr, ll
    Fregion= sh
    Fcountry= us


    My results:
    Code:
     "name filter rr ll : 80 Left / Filtered 20
    Region filter sh : 78 Left / Filtered 2
    Country filter us : 75 Left / Filtered 3
    alan filter big : 73 Left / Filtered 2
    "
    ?? – Problem is Region filter sh and Country filter us
    See uploaded file, see worksheet items 3 and 4 ( "TemporaryWorksheet" and "Tables" )


    Country filter us
    See worksheet items 4 ( "Tables" )
    In country column there are 4 with us
    Russian Federation
    Australia
    Russian Federation
    Austria


    Now see worksheet items 3 ( "TemporaryWorksheet" )
    These are taken out by Country filter us Filtered 3
    Russian Federation
    Australia
    Russian Federation

    This is taken out previously by name filter ll
    Austria ( because of Halla Hodges )


    Region filter sh
    These are taken out by Region filter sh
    Azad Kashmir
    Andhra Pradesh

    These are taken out previously by name filter ll
    Flintshire ( because of Katell Whitaker )
    Kirkcudbrightshire ( because of Yeo Allen )



    So if my current understanding of what you want is correct, then my results look correct
    So who/ what has got something wrong?




    Also see your result for example
    Count
    Total rows: 100
    Name filter: 100 Left / Filtered 0
    Region filter: 100 Left / Filtered 0
    Country filter: 96 Left / Filtered 4
    Fname=
    Fregion=
    Fcountry= us
    That finds 4 rows to remove for only us


    So how can you find 8 rows to remove for us here
    Count
    Total rows: 100
    Name filter: 80 Left / Filtered 20
    Region filter: 72 Left / Filtered 8
    Country filter: 64 Left / Filtered 8
    Fname= rr, ll
    Fregion= sh
    Fcountry= us


    I think there are only 4 rows in country column in the table with us So you can only remove maximum of 4 rows. ( It may be 4 or 3 or 2 or 1 or 0 , depending on what full rows got removed by previous filtering... )







    ( macro used in atttched file, FilTit3.xlsm , is also here: https://www.excelfox.com/forum/showt...ll=1#post23212 )
    Attached Files Attached Files
    Last edited by DocAElstein; 08-24-2023 at 07:05 PM.

Similar Threads

  1. Replies: 101
    Last Post: 06-11-2020, 02:01 PM
  2. Delete Filtered Rows Excluding The Header
    By xander1981 in forum Excel Help
    Replies: 5
    Last Post: 04-01-2014, 11:44 PM
  3. Replies: 1
    Last Post: 07-30-2013, 11:08 PM
  4. Lookup and Count Using Pivot Table
    By RobExcel in forum Excel Help
    Replies: 2
    Last Post: 12-21-2012, 11:08 AM
  5. Unique Count on a Filtered Range
    By Admin in forum Excel and VBA Tips and Tricks
    Replies: 0
    Last Post: 08-14-2011, 04:29 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •