+ Reply to Thread
Results 1 to 23 of 23

sum count of rows in changing length lists

  1. #1
    Forum Contributor
    Join Date
    04-19-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2007
    Posts
    180

    sum count of rows in changing length lists

    Hi

    Could someone tell me if it is possible to do a count of the number of rows in different groups of lists in Excel rather than VBA? Doing it in VBA is not a problem but wanted to know if an Excel function can handle it.

    For e.g

    Numbered Group1 list starts in cell A3 and is 9 rows long.
    Numbered Group2 list starts in cell D3 and is 2 rows long.
    Numbered Group3 list starts in cell A20 and is 5 rows long.
    Numbered Group4 list starts in cell D20 and is 14 rows long.

    These groups can all change length at anytime so a simple =sum(value1,value2,value3,value4) won't do.

    Thank you for any help / pointers.

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Question

    Hi

    So why asking in a VBA forum ?‼

  3. #3
    Forum Contributor
    Join Date
    04-19-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2007
    Posts
    180

    Re: sum count of rows in changing length lists

    Hi

    Apologies. I have tried Excel and suspect I will need VBA. Sorry didn't phrase my question properly, meant to say if not possible in Excel how to do in VBA with a changing length list.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: sum count of rows in changing length lists

    You are going to need to provide a workbook, either way.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  5. #5
    Forum Contributor
    Join Date
    04-19-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2007
    Posts
    180

    Re: sum count of rows in changing length lists

    OK - test sheet attached. Like I mentioned list length in each group can change so that's the issue I am having with Excel so think I need VBA.

    Simple enough issue I think ... just not for me !
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow

    If you convert each list range to a true Excel table then
    it would be so easier to count the number of all lists names via a VBA procedure …

  7. #7
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Another idea …


    Or if the 4 yellow cells are fixed and that's never change then it's easy without converting ranges to Excel tables …

  8. #8
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,522

    Re: Another idea …

    If there is no other data in that sheet.
    If there is, the "UsedRange" needs to be changed to the actual Range with the blocks of data to be counted.
    Please Login or Register  to view this content.

  9. #9
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,078

    Re: sum count of rows in changing length lists

    Maybe
    =COUNTIF(B:B,"?*")+COUNTIF(E:E,"?*")-4

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: sum count of rows in changing length lists

    How about this?

    =COUNTIFS(B:B,"<>Group*",B:B,"<>")+COUNTIFS(E:E,"<>Group*",E:E,"<>")

  11. #11
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,522

    Re: sum count of rows in changing length lists

    Another possibility.
    Sub Maybe_B()
    MsgBox WorksheetFunction.CountA(Sheets("Sheet1").Range("B:B, E:E")) - WorksheetFunction.CountIf(Sheets("Sheet1").Range("A1:E25"), "Group" & "*")
    End Sub

  12. #12
    Forum Contributor
    Join Date
    04-19-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2007
    Posts
    180

    Re: sum count of rows in changing length lists

    Thanks AliGW.

    That sort of works but if there is some other text in the column, it seems to include that in the count also (when I don't need that including). Example attached. Sorry should have made that clear earlier. Example attached.
    Attached Files Attached Files

  13. #13
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: sum count of rows in changing length lists

    Can't help unless we know what "some text" is so that it can be excluded from the count.

  14. #14
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,078

    Re: sum count of rows in changing length lists

    How about
    =COUNT(A1:E50)

  15. #15
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: sum count of rows in changing length lists

    Yes, that should do it!

  16. #16
    Forum Contributor
    Join Date
    04-19-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2007
    Posts
    180

    Re: sum count of rows in changing length lists

    Haha!

    But what about the fact that
    1. The lists can change length
    2. Other text can appear in and around the cells which are not related to the number of names

    Once again apologies .. I’ve realised I could have been clearer in my original post. Essentially I need a count of the number of names only but the number of names in each group keeps changing on a weekly basis.

    Thanks again

  17. #17
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,078

    Re: sum count of rows in changing length lists

    Change the formula range to make it large enough to cover all eventualities.

  18. #18
    Forum Contributor
    Join Date
    04-19-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2007
    Posts
    180

    Re: sum count of rows in changing length lists

    Thanks Fluff13 but that still doesn't solve the issue that other text (can be numerous things) may exist in the columns which are not "part of the count" ?? I only want the total number of names.

    In VBA I have been looking for a lookup for where the text "group 1" starts and then do a count for "last row" in that group1 ... then the same for the other group2,3,4 and then a final count but not finding exactly what I am after so it was back to the board.

    Thanks again
    Last edited by technik; 09-15-2019 at 02:30 PM.

  19. #19
    Forum Contributor
    Join Date
    04-19-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2007
    Posts
    180

    Re: sum count of rows in changing length lists

    Thanks jolivanes wiil try it out.

  20. #20
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,078

    Re: sum count of rows in changing length lists

    That formula only counts the cells that contain numbers & therefore any additional text is irrelevant.

  21. #21
    Forum Contributor
    Join Date
    04-19-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2007
    Posts
    180

    Re: sum count of rows in changing length lists

    Thankyou

  22. #22
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,078

    Re: sum count of rows in changing length lists

    You're welcome & thanks for the feedback

  23. #23
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,522

    Re: sum count of rows in changing length lists

    With the goalposts being moved constantly, here is another possibility.
    Please Login or Register  to view this content.
    I just read your Post #18 and it looks like this is what you tried to achieve.
    Last edited by jolivanes; 09-15-2019 at 02:46 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 07-27-2014, 10:23 AM
  2. How to Match and fill two lists of unequal length
    By artaxerxes in forum Excel General
    Replies: 6
    Last Post: 01-24-2012, 04:21 PM
  3. Excel 2007 : Multiple Variable Length Lists to 1 List
    By Sarah12 in forum Excel General
    Replies: 5
    Last Post: 02-10-2011, 08:07 PM
  4. Combining variable length lists from multiple worksheets
    By xvart in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-21-2008, 02:45 PM
  5. Taking data from varied length lists.
    By Rgaherty in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-05-2008, 02:26 PM
  6. [SOLVED] Validation drop-down lists:increase the default length
    By Lee in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-05-2006, 02:40 PM
  7. [SOLVED] Fixed Length Lists? Excel / XML Project
    By ManinBlaq in forum Excel General
    Replies: 0
    Last Post: 03-23-2005, 02:06 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1