Forum Discussion

Marcus_Booth's avatar
Marcus_Booth
Copper Contributor
Feb 14, 2025

How to return counts of text cells across multiple worksheets in same workbook?

I'm working in Excel 365. Windows environment.

Working in the Excel app but will be posting to a shared drive for multi-user data entry.

38 worksheets, one for each office.

 

What I need is to be able to return the total # of records in the data set that are marked as 'Complete', 'Pending' and 'Urgent' (from a drop-down is one cell of each record), by office and the Rep's name that made the entry (also from drop-down). 

I would also like to be able to return the total entries across all worksheets by Rep Name, so I can see which offices/Reps are making the most/least entries. 

 

I'm not very savvy with using Power Query. I've tried to do it, but I think it requires that there are no blank cells in the records. It keeps making tables in the query that don't actually exist. Tried it using 6 worksheets, just to test it, and the appended data set contains way more tables that I added. 

I'm not bad with pivot tables. If anyone has an idea of how I could accomplish this, I sure would appreciate it! Thanks in advance for any assistance. :) 

16 Replies

  • Suggested by Patrick2788  Power Query could be simplified a bit, actually we may have only one query

    let
        Source = Excel.CurrentWorkbook(),
    
        Tabs = Source{[Name="OfficeTabs"]}[Content][Office Tabs List],
        Tables = List.Transform( Tabs, (q) => q & "Tbl"),
    
        SelectTables = Table.SelectRows(Source, each List.Contains( Tables ,[Name] ) ),
        SelectContent = Table.SelectColumns(SelectTables,{"Content"}),
    
        NamesToKeep = {"Office", "Entered By", "Status:"},
        ExpandContent = Table.ExpandTableColumn(SelectContent, "Content", NamesToKeep)
    
    in
        ExpandContent

    loaded into the grid as PivotTable. If transformation of each table is required and/or it'll be ranges, not tables - above works as idea, changes won't be dramatically complex.

    See CombineOffices query in attached.

    • Marcus_Booth's avatar
      Marcus_Booth
      Copper Contributor

      This is what I was trying to do at the beginning. Very much looks like it will work for me, although my initial attempts failed. I will certainly give this a try and let you know how it works out. OliverScheurich also offered a formula-based solution below which I'm exploring. Thanks for the Power Query support document as well. Your assistance is greatly appreciated! 

  • Harun24HR's avatar
    Harun24HR
    Bronze Contributor

    Can you please post few sample data and show your desired output? You may attach a sample file here or share via OneDrive, Google-Drive, Dropbox or same.

  • =IFNA(LET(StackedSheets,VSTACK(Office1:Office3!A2:C10),
    HSTACK(
    VSTACK(HSTACK("Status","Count"),GROUPBY(CHOOSECOLS(StackedSheets,3),CHOOSECOLS(StackedSheets,3),ROWS,,0)),"",
    VSTACK(HSTACK("Office","Status","Count"),GROUPBY(CHOOSECOLS(StackedSheets,2,3),CHOOSECOLS(StackedSheets,3),ROWS,,0)),"",
    VSTACK(HSTACK("Rep's name","Office","Status","Count"),GROUPBY(StackedSheets,CHOOSECOLS(StackedSheets,3),ROWS,,0)))),"")

    If you have access to GROUPBY you can apply this formula. In the first step all tables are stacked into one combined table and then GROUPBY returns the results in a way similar to a Pivot Table. Instead of sheets Office1:Office3 you can reference sheets Office1:Office38 in the same way.

    This is how the tables are laid out in my example. Above is sheet "Office3" for all entries of this office.

    • Marcus_Booth's avatar
      Marcus_Booth
      Copper Contributor

      Oh wow! This will be sweet if it works. I will let you know how it goes. Thank you!!

      • Marcus_Booth's avatar
        Marcus_Booth
        Copper Contributor

        Unfortunately, I'm restricted by admin. from using macros due to security concerns. Apparently, that is what this is because I get warnings left and right when I try and paste into my workbook. Also, when I just type =GROUPBY, it's not listed as active. Back to the drawing board! 

        If it would be helpful, as suggested in the first response above, I could send something with 'dummy' data so you can see what I have structurally. 

Resources