Page 4 of 6 FirstFirst ... 23456 LastLast
Results 31 to 40 of 51

Thread: VBA - Count filtered rows in the table

  1. #31
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,455
    Rep Power
    10
    I have a quick question on you….
    Are you results here: https://www.excelfox.com/forum/showt...3218#post23218 , supposed to be the correct results for the text or csv file?

    My results ( with any of my or your text or csv files are different. )

    For example, filter first FName of rr
    I only ever find 6 to filter








    Your result
    Code:
     "Total rows: 100
    Name filter: 80 Left / Filtered 20
    Region filter: 72 Left / Filtered 8
    Country filter: 22 Left / Filtered 50"
    
    

    My results, (with any of the text files or csv files)
    Code:
     "Total rows: 100
    name filter by rr: 94 Left / Filtered 6
    region filter by sh: 90 Left / Filtered 4
    country filter by us: 86 Left / Filtered 4
    "


    How do you filter 20 by rr from this
    Code:
    name
    Pascale Murray
    Harrison Irwin
    Kim Buckner
    Mia Cruz
    Sierra Howe
    Kyra Osborne
    Matthew Jenkins
    Adria Mayo
    Patricia Rodriguez
    Nolan Hurst
    Cleo Munoz
    Scarlet David
    Madonna Parks
    Derek Cain
    Zorita Harvey
    Lev Stout
    George Blake
    Adele Burgess
    Curran Herring
    Jenette Stanton
    Katell Whitaker
    Phillip Hunter
    Martena Cotton
    Brenda Mclaughlin
    Brett Blackwell
    Alma Curtis
    Ainsley Battle
    Glenna Gregory
    Julian Castillo
    Beatrice Whitley
    Brooke Daniel
    Nicholas Douglas
    Kelly Ware
    Peter Velazquez
    Erasmus Hughes
    Reese Bray
    MacKenzie Ray
    Audra Nolan
    Jin Mcmillan
    Alec Guzman
    Ciara Hurst
    Yasir Rollins
    Logan Lara
    Wayne Holcomb
    Madonna Ayers
    Christian Graves
    Ingrid Harper
    Rafael Emerson
    Chandler Burks
    Jaquelyn Hendrix
    Roanna Reynolds
    Chandler Baldwin
    Wanda Luna
    Blake Herring
    Odette Gordon
    Ignacia Randolph
    Haley Ewing
    Keaton Mckay
    Yeo Allen
    Chester Whitfield
    Kadeem Calhoun
    Clinton Mcgowan
    Macon Burke
    Yen Griffin
    Dieter Christensen
    Rafael Ferguson
    Rana Graves
    Hilel Marshall
    Lev Osborne
    Amela Benjamin
    Brock Gomez
    Raphael Gonzalez
    Armando Roach
    Iona Glenn
    Rose Brennan
    Adara Mcguire
    Jarrod Mccarthy
    Aiko Hardy
    Blythe Knapp
    Jameson Ramsey
    Idona Flynn
    Rogan Mcneil
    Kiayada Spencer
    Dillon Dunlap
    Anastasia Powers
    Neil Walter
    Jin Gilliam
    Stephanie Mann
    Petra Sellers
    Armando Fuentes
    Amy Eaton
    Kessie Parsons
    Bo Irwin
    Ariel Rice
    Chancellor Ratliff
    Jana Hickman
    Halla Hodges
    Tiger Gay
    Kenneth Delacruz
    Mikayla Pacheco



    Is the answer…
    First you filter FName ll
    then FName by rr

    Then FRegion by sh

    Then FCountry by us


    If that is the answer, then I will have to re write my macro because it does not do that. My macro just uses the last things added, so it does this

    Is the answer…
    First FName by rr

    Then FRegion by sh

    Then FCountry by us

  2. #32
    Sir Moderator sandy666's Avatar
    Join Date
    May 2018
    Posts
    239
    Rep Power
    7

    Cool

    here is some results

    Count
    Total rows: 100
    Name filter: 94 Left / Filtered 6
    Region filter: 94 Left / Filtered 0
    Country filter: 94 Left / Filtered 0
    Fname= rr

    Count
    Total rows: 100
    Name filter: 80 Left / Filtered 20
    Region filter: 80 Left / Filtered 0
    Country filter: 80 Left / Filtered 0
    Fname= rr, ll

    Count
    Total rows: 100
    Name filter: 80 Left / Filtered 20
    Region filter: 72 Left / Filtered 8
    Country filter: 72 Left / Filtered 0
    Fname= rr, ll
    Fregion= sh

    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

    Count
    Total rows: 100
    Name filter: 100 Left / Filtered 0
    Region filter: 96 Left / Filtered 4
    Country filter: 92 Left / Filtered 4
    Fname=
    Fregion= sh
    Fcountry= us

    Count
    Total rows: 100
    Name filter: 100 Left / Filtered 0
    Region filter: 96 Left / Filtered 4
    Country filter: 96 Left / Filtered 0
    Fname=
    Fregion= sh
    Fcountry=

    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

    Count
    Total rows: 100
    Name filter: 100 Left / Filtered 0
    Region filter: 100 Left / Filtered 0
    Country filter: 100 Left / Filtered 0
    Fname=
    Fregion=
    Fcountry=
    sandy
    I know you know but I forgot my Crystal Ball and don't know what you know also I may not remember what I did weeks, months or years ago so answer asap. Thinking doesn't hurt

  3. #33
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,455
    Rep Power
    10
    OK, so answer is like
    Quote Originally Posted by DocAElstein View Post
    .....the answer…
    First you filter FName by ll
    then FName by rr

    Then FRegion by sh

    Then FCountry by us
    ...
    Filter by all entries in a F___ column, then go on to the next F___ column and do the same, but the results you want are
    totals Removed(Filtered) / Left
    for each F___ column.

    I will do another macro later….

    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    https://www.youtube.com/watch?v=oVb1RfcSHLM&lc=UgwTq-jZlZLnLQ5VB8Z4AaABAg.9Hroz-OyWog9tYjSMc1qjA
    https://www.youtube.com/watch?v=0pbsf6sox34&lc=Ugxp9JFvvejnqA68W1t4AaABAg
    https://www.youtube.com/watch?v=kfQC-sQxMcw&lc=UgyCxQWypNIhG2nUn794AaABAg.9q1p6q7ah839t UQl_92mvg
    https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgyOh-eR43LvlIJLG5p4AaABAg.9isnKJoRfbL9itPC-4uckb
    https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugy1B1aQnHq2WbbucmR4AaABAg. 9isY3Ezhx4j9itQLuif26T
    https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgxxajSt03TX1wxh3IJ4AaABAg. 9irSL7x4Moh9itTRqL7dQh
    https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg. 9irLgSdeU3r9itU7zdnWHw
    https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwJAAPbp8dhkW2X1Uh4AaABAg. 9iraombnLDb9itV80HDpXc
    https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgzIzQ6MQ5kTpuLbIuB4AaABAg. 9is0FSoF2Wi9itWKEvGSSq
    https://www.youtube.com/watch?v=ITI1HaFeq_g&lc=UgykemWTw-fGoPwu8E14AaABAg.9iECYNx-n4U9iK75iCEaGN
    https://www.youtube.com/watch?v=ITI1HaFeq_g&lc=UgykemWTw-fGoPwu8E14AaABAg.9iECYNx-n4U9iK7XF33njy
    https://www.youtube.com/watch?v=ITI1HaFeq_g&lc=Ugy_1xkcndYdzUapw-J4AaABAg.9iGOq_leF_E9iKCSgpAqA1
    https://www.youtube.com/watch?v=ITI1HaFeq_g&lc=Ugy_1xkcndYdzUapw-J4AaABAg.9iGOq_leF_E9iKCy--3x8E
    https://www.youtube.com/watch?v=ITI1HaFeq_g&lc=UgwNaJiNATXshvJ0Zz94AaABAg. 9iEktVkTAHk9iF9_pdshr6
    https://www.youtube.com/watch?v=ITI1HaFeq_g&lc=UgykemWTw-fGoPwu8E14AaABAg.9iECYNx-n4U9iFAZq-JEZ-
    https://www.youtube.com/watch?v=ITI1HaFeq_g&lc=UgxV2r7KQnuAyZVLHH54AaABAg. 9iDVgy6wzct9iFBxma9zXI
    https://www.youtube.com/watch?v=ITI1HaFeq_g&lc=Ugx12mI-a39T41NaZ8F4AaABAg.9iDQqIP56NV9iFD0AkeeJG
    https://www.youtube.com/watch?v=ITI1HaFeq_g&lc=UgwnYuSngiuYaUhEMWN4AaABAg. 9iDQN7TORHv9iFGQQ5z_3f
    https://www.youtube.com/watch?v=ITI1HaFeq_g&lc=UgwJ3yzdk_EE98dndmt4AaABAg. 9iDLC2uEPRW9iFGvgk11nH
    https://www.youtube.com/watch?v=ITI1HaFeq_g&lc=UgyDWAVqCa4yMot463x4AaABAg. 9iH3wvUZj3n9iHnpOxOeXa
    https://www.youtube.com/watch?v=ITI1HaFeq_g&lc=UgwvLFdMEAba5rLHIz94AaABAg. 9iGReNGzP4v9iHoeaCpTG8
    https://www.youtube.com/watch?v=ITI1HaFeq_g&lc=Ugy_1xkcndYdzUapw-J4AaABAg.9iGOq_leF_E9iHpsWCdJ5I
    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    Last edited by DocAElstein; 08-26-2023 at 10:25 PM.

  4. #34
    Sir Moderator sandy666's Avatar
    Join Date
    May 2018
    Posts
    239
    Rep Power
    7
    filters filtering columns but rows are counting for whole table, that is why this is an Excel Table (source from CSV) not Range
    sandy
    I know you know but I forgot my Crystal Ball and don't know what you know also I may not remember what I did weeks, months or years ago so answer asap. Thinking doesn't hurt

  5. #35
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,455
    Rep Power
    10
    Quote Originally Posted by sandy666 View Post
    filters filtering columns but rows are counting for whole table, ….
    Yep, I guessed that bit right already, …but I almost didn’t, - so in other words you remove(filter) entire rows in the table where you find, for example, rr , in the first table column.

    I think I am either 100% there in understanding what you want now, or I am very close.

    I also know exactly how you want the final output. I will try to do that eventually. But if I had originally tried to do the output exactly as you wanted from the start, then
    _ it would be more difficult for me to change it now,
    and
    _ I might not have noticed my mistake….

    ….I have not done so much Excel Filter work so I did not know how filters on table typically work….. I know you know but I forgot my hairy fucking Crystal Bollocks and didn't know




    Quote Originally Posted by sandy666 View Post
    …., that is why this is an Excel Table (source from CSV) not Range
    I don’t know anything about that, I don’t know what is a Poxy fucking Excel Table is either
    Never mind, it's probably not important




    I will take anothert look later.- I am going now for my long daily jog along my the old railway track.

    Its beautiful. I do it early while it’s still sunny, so I get a nice Sun tan on my body so that I will be even more beautiful in my YouTube videos...
    Last edited by DocAElstein; 08-23-2023 at 07:36 PM.

  6. #36
    Sir Moderator sandy666's Avatar
    Join Date
    May 2018
    Posts
    239
    Rep Power
    7

    Cool

    Take more pics from your jogging track
    Your YT videos = 0
    sandy
    I know you know but I forgot my Crystal Ball and don't know what you know also I may not remember what I did weeks, months or years ago so answer asap. Thinking doesn't hurt

  7. #37
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,455
    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.

  8. #38
    Sir Moderator sandy666's Avatar
    Join Date
    May 2018
    Posts
    239
    Rep Power
    7
    Code:
                total = Table.RowCount(TPH),
                name = Text.From(Table.RowCount(TPH)-Table.RowCount(TSR))&" Left / Filtered "&Text.From(Table.RowCount(TSR)),
                region = Text.From(Table.RowCount(TPH)-Table.RowCount(TSR)-Table.RowCount(TSR1))&" Left / Filtered "&Text.From(Table.RowCount(TSR1)),
                country = Text.From(Table.RowCount(TPH)-Table.RowCount(TSR)-Table.RowCount(TSR1)-Table.RowCount(TSR2))&" Left / Filtered "&Text.From(Table.RowCount(TSR2))
    total
    total-filtered1
    total-filtered1-filtered2
    total-filtered1-filtered2-filtered3
    sandy
    I know you know but I forgot my Crystal Ball and don't know what you know also I may not remember what I did weeks, months or years ago so answer asap. Thinking doesn't hurt

  9. #39
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,455
    Rep Power
    10
    Quote Originally Posted by sandy666 View Post
    total
    total-filtered1
    total-filtered1-filtered2
    total-filtered1-filtered2-filtered3
    I assume you are trying to say
    Total rows
    Left after name filter1 ( rr ll ) = total-filtered1
    Left after region filter2 ( sh ) = total-filtered1-filtered2
    Left after country filter3 ( us ) = total-filtered1-filtered2-filtered3

    That is not the problem

    Problems is:
    _1 ) How can you remove(Filtered) 8 lines when filtering out by sh in region column
    that is impossible: there are only 4 lines in original table with a sh in region column
    _2 ) How can you remove(Filtered) 8 lines when filtering out by us in country column
    that is impossible: there are only 4 lines in original table with a us in country column

    Quote Originally Posted by DocAElstein View Post
    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

    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    https://www.youtube.com/watch?v=oVb1RfcSHLM&lc=UgwTq-jZlZLnLQ5VB8Z4AaABAg.9Hroz-OyWog9tYjSMc1qjA
    https://www.youtube.com/watch?v=0pbsf6sox34&lc=Ugxp9JFvvejnqA68W1t4AaABAg
    https://www.youtube.com/watch?v=kfQC-sQxMcw&lc=UgyCxQWypNIhG2nUn794AaABAg.9q1p6q7ah839t UQl_92mvg
    https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgyOh-eR43LvlIJLG5p4AaABAg.9isnKJoRfbL9itPC-4uckb
    https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugy1B1aQnHq2WbbucmR4AaABAg. 9isY3Ezhx4j9itQLuif26T
    https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgxxajSt03TX1wxh3IJ4AaABAg. 9irSL7x4Moh9itTRqL7dQh
    https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg. 9irLgSdeU3r9itU7zdnWHw
    https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwJAAPbp8dhkW2X1Uh4AaABAg. 9iraombnLDb9itV80HDpXc
    https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgzIzQ6MQ5kTpuLbIuB4AaABAg. 9is0FSoF2Wi9itWKEvGSSq
    https://www.youtube.com/watch?v=ITI1HaFeq_g&lc=UgykemWTw-fGoPwu8E14AaABAg.9iECYNx-n4U9iK75iCEaGN
    https://www.youtube.com/watch?v=ITI1HaFeq_g&lc=UgykemWTw-fGoPwu8E14AaABAg.9iECYNx-n4U9iK7XF33njy
    https://www.youtube.com/watch?v=ITI1HaFeq_g&lc=Ugy_1xkcndYdzUapw-J4AaABAg.9iGOq_leF_E9iKCSgpAqA1
    https://www.youtube.com/watch?v=ITI1HaFeq_g&lc=Ugy_1xkcndYdzUapw-J4AaABAg.9iGOq_leF_E9iKCy--3x8E
    https://www.youtube.com/watch?v=ITI1HaFeq_g&lc=UgwNaJiNATXshvJ0Zz94AaABAg. 9iEktVkTAHk9iF9_pdshr6
    https://www.youtube.com/watch?v=ITI1HaFeq_g&lc=UgykemWTw-fGoPwu8E14AaABAg.9iECYNx-n4U9iFAZq-JEZ-
    https://www.youtube.com/watch?v=ITI1HaFeq_g&lc=UgxV2r7KQnuAyZVLHH54AaABAg. 9iDVgy6wzct9iFBxma9zXI
    https://www.youtube.com/watch?v=ITI1HaFeq_g&lc=Ugx12mI-a39T41NaZ8F4AaABAg.9iDQqIP56NV9iFD0AkeeJG
    https://www.youtube.com/watch?v=ITI1HaFeq_g&lc=UgwnYuSngiuYaUhEMWN4AaABAg. 9iDQN7TORHv9iFGQQ5z_3f
    https://www.youtube.com/watch?v=ITI1HaFeq_g&lc=UgwJ3yzdk_EE98dndmt4AaABAg. 9iDLC2uEPRW9iFGvgk11nH
    https://www.youtube.com/watch?v=ITI1HaFeq_g&lc=UgyDWAVqCa4yMot463x4AaABAg. 9iH3wvUZj3n9iHnpOxOeXa
    https://www.youtube.com/watch?v=ITI1HaFeq_g&lc=UgwvLFdMEAba5rLHIz94AaABAg. 9iGReNGzP4v9iHoeaCpTG8
    https://www.youtube.com/watch?v=ITI1HaFeq_g&lc=Ugy_1xkcndYdzUapw-J4AaABAg.9iGOq_leF_E9iHpsWCdJ5I
    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    Last edited by DocAElstein; 08-31-2023 at 12:35 PM.

  10. #40
    Sir Moderator sandy666's Avatar
    Join Date
    May 2018
    Posts
    239
    Rep Power
    7

    Cool

    it should be a proper result

    Count
    Total rows: 100
    Name filter: 86 Left / Filtered 14
    Region filter: 82 Left / Filtered 4
    Country filter: 79 Left / Filtered 3
    sandy
    I know you know but I forgot my Crystal Ball and don't know what you know also I may not remember what I did weeks, months or years ago so answer asap. Thinking doesn't hurt

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
  •