+ Reply to Thread
Results 1 to 15 of 15

Get number of entries in datatable in different excel sheets in a workbook

  1. #1
    Registered User
    Join Date
    11-11-2021
    Location
    New Zealand
    MS-Off Ver
    Office 365
    Posts
    54

    Get number of entries in datatable in different excel sheets in a workbook

    Hi
    I have a number of sheets in an excel workbook with data tables created by a sql query. I would like to get the number of rows with data from each sheet onto a summary sheet. What is the formula for this?

    pic1.PNG

    For example the attached image has 2 rows of data in one sheet, so I need to refer to the sheet name and the number of rows in a table in a summary sheet as below:
    pic2.PNG

    Appreciate any help

    Regards

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2505
    Posts
    27,268

    Re: Get number of entries in datatable in different excel sheets in a workbook

    This is not an especially hard problem but it's not just a matter of "the formula" and the answer has to be very specific to how your file is organized, and we don't have those details.

    From your screenshot it looks like you are using structured tables. The result is a lot easier if you refer to the table name instead of the sheet name that contains it. For example, if your table is called Table1, the count is
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Table names are unique so this does not depend on which sheet it is on.


    If you need more specific help please attach a sample file so we can see how your sheets are set up. See yellow banner at the top of the page.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    11-11-2021
    Location
    New Zealand
    MS-Off Ver
    Office 365
    Posts
    54

    Re: Get number of entries in datatable in different excel sheets in a workbook

    Hi Jeff
    Thanks. I figured out the formula =ROWS(Table1) after posting this question. However is there a way to get the table name from the sheet number? My summary sheet looks as follows. So is there a way i can write a formula to get the table name from the sheet number and then use it in the ROWS() formula?

    Attachment 878339

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2505
    Posts
    27,268

    Re: Get number of entries in datatable in different excel sheets in a workbook

    You can't retrieve a table name or table data based on sheet name without using VBA. Is your workbook structure dynamic, or do you just need a one-time setup?

    For a more detailed solution it will help if you attach a sample file.

  5. #5
    Registered User
    Join Date
    11-11-2021
    Location
    New Zealand
    MS-Off Ver
    Office 365
    Posts
    54

    Re: Get number of entries in datatable in different excel sheets in a workbook

    Here is a sample sheet attached.
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,990

    Re: Get number of entries in datatable in different excel sheets in a workbook

    If your table position is fixed,you can try this in D2 and copy down.
    Please Login or Register  to view this content.

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,919

    Re: Get number of entries in datatable in different excel sheets in a workbook

    Or try this:

    =IFERROR(ROWS(TOCOL(INDIRECT("'"&C2&"'!A2:A1000"),1)),"")
    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. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  8. #8
    Registered User
    Join Date
    11-11-2021
    Location
    New Zealand
    MS-Off Ver
    Office 365
    Posts
    54

    Re: Get number of entries in datatable in different excel sheets in a workbook

    windknife's answer worked. I am not sure how to mark this as answered.

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,919

    Re: Get number of entries in datatable in different excel sheets in a workbook

    So does mine, and it's shorter.

    If that takes care of your original question, please choose Thread Tools from the menu link above and mark this thread as SOLVED. You can also access the SOLVED tag by editing the opening post and choosing SOLVED from the drop-down to the left of the title box.

    Also, if you have not already done so, remember that you can reward anyone who offered you help towards a solution for your issue by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of each of those who offered help.

  10. #10
    Registered User
    Join Date
    11-11-2021
    Location
    New Zealand
    MS-Off Ver
    Office 365
    Posts
    54

    Re: Get number of entries in datatable in different excel sheets in a workbook

    Thanks Ali. Sorry i misunderstood - i thought the first formula is for dynamic tables and yours is for static ones. I have now used yours. Also thank you for the instructions on how to mark this as Solved. Regards

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

    Re: Get number of entries in datatable in different excel sheets in a workbook

    No, they both do the same thing - both need drag copying down.

    Thanks for the rep.

  12. #12
    Registered User
    Join Date
    11-11-2021
    Location
    New Zealand
    MS-Off Ver
    Office 365
    Posts
    54

    Re: Get number of entries in datatable in different excel sheets in a workbook

    Can I extend this question to get the formula to count rows with a certain value in the column? Please see attached sample sheet.
    Attached Files Attached Files

  13. #13
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,990

    Re: Get number of entries in datatable in different excel sheets in a workbook

    Try this in D2.
    Please Login or Register  to view this content.
    Try this in E2.
    Please Login or Register  to view this content.

  14. #14
    Registered User
    Join Date
    11-11-2021
    Location
    New Zealand
    MS-Off Ver
    Office 365
    Posts
    54

    Re: Get number of entries in datatable in different excel sheets in a workbook

    Thanks for the suggestion. That worked like magic.

  15. #15
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,990

    Re: Get number of entries in datatable in different excel sheets in a workbook

    You are welcome.

+ 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. VB Code That returns all entries form all sheets to one worksheet or workbook.
    By dalasgalas in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-14-2015, 10:15 AM
  2. [SOLVED] Generate sheets with template based on datatable
    By kanonathena in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-21-2013, 11:49 PM
  3. splitting excel workbook into seperate sheets depending on number of rows
    By buketdurusoy in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 12-28-2012, 04:52 PM
  4. [SOLVED] Need to Highlight New Entries Between 2 Sheets in Same Workbook
    By Whit804 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-30-2012, 11:48 AM
  5. Getting number of entries in other sheets
    By MaximusPrimal in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 09-27-2009, 03:49 AM
  6. Replies: 0
    Last Post: 11-08-2007, 03:13 AM
  7. DataTable number format
    By MB in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-21-2005, 04:06 PM

Tags for this Thread

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