Page 1
Page 1
Started By
Message

Excel Help - Suggestions

Posted on 4/19/24 at 7:44 pm
Posted by Piece
Member since Aug 2016
208 posts
Posted on 4/19/24 at 7:44 pm
I have a weekly report that I get in excel that has seperate tabs by department that shows utilization. I'm trying to get a yearly summary of these reports. I can't get it from the source because each excel typically has to modified manually for accuracy. It's 52 documents with 7 tabs each. The columns always remain the same but the rows change with the flucations of people.

What is the best way to combine these? A summary of each department would be sufficient, but individual personnel summaries would be nice. Right now I'm thinking of combining each department into an excel and doing some vlookups but that seems tedious. Anything I'm missing here?
Posted by BoudreauxsCousin
Member since May 2011
180 posts
Posted on 4/20/24 at 5:25 am to
Honestly, Excel wouldn't be the right tool to do this, in my opinion. VLOOKUPs would be tedious and the sort has to be correct, or the formulas will provide the wrong result. You could import each spreadsheet/tab into Access and query any way you want.

You'd need to add a couple of columns to each spreadsheet to show which week and tab for tracking, but each week you could import and append the data to a master list. Then you've got all the records in one place to report on as you go along.

Just some thoughts. Once you get it set up, it's fairly straight forward.
Posted by RoyalWe
Prairieville, LA
Member since Mar 2018
3116 posts
Posted on 4/20/24 at 5:46 pm to
I'm not very experienced in using it, but Power Query Editor allows you to import data from all files within a folder (as long as they all follow the same format).

Posted by Spankum
Miss-sippi
Member since Jan 2007
56005 posts
Posted on 4/20/24 at 7:42 pm to
What you need is called a “pivot table”. Just have whoever produces the report for you learn how to do it.
Posted by boomtown143
Merica
Member since May 2019
6695 posts
Posted on 4/20/24 at 8:36 pm to
copy the 7 tabs into one tab(assuming the columns are the same on each tab) and make a pivot table.
This post was edited on 4/20/24 at 8:37 pm
Posted by EngineerOnDemand
Member since Apr 2013
172 posts
Posted on 4/21/24 at 10:48 am to
You could probably do some powerful work with indirect and sumifs or xlookup.

Use indirect to find the tab you’re looking for and sumifs or xlookup to find the data you’re looking for.
Posted by dtett
Jiggacity
Member since Oct 2018
511 posts
Posted on 4/22/24 at 9:58 am to
I would use power query in two steps.

One to combine all the tabs into one data source.

Then query all 52 documents into one master file.

Then you can slice and dice like you would any table in excel.
Posted by RoyalWe
Prairieville, LA
Member since Mar 2018
3116 posts
Posted on 4/22/24 at 12:52 pm to
quote:


I would use power query in two steps.

One to combine all the tabs into one data source.

Then query all 52 documents into one master file.

Then you can slice and dice like you would any table in excel.
A lot of people jumped straight to "do a pivot table" which is the answer once you get the 52 (or however many) files together. Power Query is the easist way I know to do this.
Posted by Piece
Member since Aug 2016
208 posts
Posted on 4/23/24 at 10:36 am to
quote:

Power Query is the easist way I know to do this.


This was the method I chose, and it worked perfectly. Never had used the tool before but once I was able to get the first sheet transformed correctly it went pretty smooth. I created a second sheet in the workbook for my formulas, created a formula array to identify unique values and then sumifs the rest of the columns. Once that workbook was completed, I just performed the same transformations on the next one, copied my formula sheet, and updated the formulas. Took about an hour and half all in.

I appreciate the assistance.
Posted by HeadyMurphey
Los Santos
Member since Jan 2008
17184 posts
Posted on 4/24/24 at 6:10 pm to
Don't force the current tool to do what you need. Think outside the box. That data is coming to you in excel format from a database. They are using something such as SSIS or SSRS to create that. Discuss with the source of that data. Tell them your business need and how much time you waste formatting it how you need.

Let them create the right solution a d you both celebrate the value add opportunity and cost savings.
Posted by Chromdome35
NW Arkansas
Member since Nov 2010
6834 posts
Posted on 4/25/24 at 10:38 pm to
The only non tedius way to accomplish this would be to write a VBA program to open each workbook/tab and copy the data from each tab into a consolidation table. You would append each tabs data onto the end of the consolidation table.

This would get all of the data into one sheet which you could then slice/dice via pivot table to provide your analysis.

Depending on how the data is structured, you might have to add a column or two to add date time, division, etc... This would be easy to do in the VBA script.

I'm currently solving a similar problem at work by this method, the only difference is I'm doing it Google Sheets with Google Application Script instead of Excel with VBA. Its the same process and result in both apps.
Posted by Chromdome35
NW Arkansas
Member since Nov 2010
6834 posts
Posted on 4/25/24 at 10:47 pm to
To accomplish this, turn to ChatGPT.

I gave ChatGPT the following prompt based on your description.

quote:

In Microsoft Excel, I have 52 workbooks containing 7 tabs. Each workbook represents a week of the year and each tab has the utilization data for a division of our company for that week. The Utilization data is in the same column structure in every tab, the only thing that varies is the number of rows of data. The number of rows of data is dynamic every week on every tab. Write a VBA script that will read the data from each of the tabs in each weeks workbook and combine the data into a single consolidated data table in a separate spreadsheet.


ChatGPT yielded the following VBA Script:

quote:

Sub ConsolidateData()
Dim ws As Worksheet
Dim masterWorkbook As Workbook
Dim dataWorkbook As Workbook
Dim targetSheet As Worksheet
Dim lastRow As Long, lastColumn As Long
Dim dataLastRow As Long
Dim sourceRange As Range
Dim targetRange As Range
Dim folderPath As String
Dim filename As String
Dim weekNum As Integer

' Set the folder path where the weekly workbooks are stored
folderPath = "C:\Path\To\Your\Weekly\Workbooks\" ' Change this to the path where your files are stored

' Create a new workbook
Set masterWorkbook = Workbooks.Add
Set targetSheet = masterWorkbook.Sheets(1)
targetSheet.Name = "Consolidated Data"

' Loop through each workbook
For weekNum = 1 To 52
filename = folderPath & "Week" & weekNum & ".xlsx" ' Adjust the file naming convention as needed

' Open each workbook
Set dataWorkbook = Workbooks.Open(filename)

' Loop through each sheet
For Each ws In dataWorkbook.Sheets
With ws
lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
lastColumn = .Cells(1, .Columns.Count).End(xlToLeft).Column
Set sourceRange = .Range(.Cells(1, 1), .Cells(lastRow, lastColumn)) ' Adjust the range as needed

' Find the next empty row in the master sheet
dataLastRow = targetSheet.Cells(targetSheet.Rows.Count, "A").End(xlUp).Row + 1

' Set the target range
Set targetRange = targetSheet.Cells(dataLastRow, 1)

' Copy data from source to target
sourceRange.Copy Destination:=targetRange
End With
Next ws

' Close the data workbook without saving
dataWorkbook.Close SaveChanges:=False
Next weekNum

' Save the master workbook
masterWorkbook.SaveAs folderPath & "ConsolidatedData.xlsx"
masterWorkbook.Close SaveChanges:=False

' Inform user
MsgBox "Data consolidation complete!"
End Sub


If you need to add columns to the result for adding date/time, division, etc... to the consolidated data, just tell ChatGPT what you want, where it is in the source data and where you want it to appear in the consolidated data.
This post was edited on 4/25/24 at 10:49 pm
Posted by captainpodnuh
Baton Rouge, LA
Member since Jan 2004
478 posts
Posted on 4/26/24 at 3:06 pm to
Short answer is ChatGPT for all simple software coding. It’s a no brainer. May require minor tweaks but generally it’s solid. A client has been demoing Copilot in their org and is seeing immediate value.
Posted by Joev1
Baton Rouge
Member since Aug 2019
69 posts
Posted on 5/3/24 at 11:51 am to
Have you gotten the solution you wanted for this? I’d suggest PowerBi. I’d be willing to help
Posted by messyjesse
Member since Nov 2015
2031 posts
Posted on 5/3/24 at 12:46 pm to
Gonna echo what others have suggested and recommend giving Power Query a look. It is not a substitute for a true ETL tool but it is still powerful and flexible, and integrates seamlessly into Excel and Power BI. The amount of random junk you can use as a data source alone is incredible.
first pageprev pagePage 1 of 1Next pagelast page
refresh

Back to top
logoFollow TigerDroppings for LSU Football News
Follow us on Twitter, Facebook and Instagram to get the latest updates on LSU Football and Recruiting.

FacebookTwitterInstagram