VBA to update multiple sheets from main spreadsheet based on department name - excel

I have a spreadsheet that is used to track audit scores for 9 different departments in a plant. The 9 departments are broken down to 117 different area locations. Once a month I add a new column and update the scores. What I would like is a seperate sheet for each department with the audit scores updating automatically when I import the original data in. I'm new to VBA programming and this may be over my head a little bit, is there a way to do this?

Why not using a pivot table in each tab ?
You'll only have to use the "actualize" command once ( Data-->Refresh all) whenever you're adding a column.
The thing you have ot be careful with is to set-up you master table as a list (Home tab-->Format as a table command ) or else the pivot table will not take account of an added new column.

Without seeing the actual data and the format the it is currently in...
Assuming that you make a separate sheet for each department each with a row corresponding to its respective area...
I would utilize a class to hook the application's events and update each sheet on the Worksheet_Change event. Chip Pearson provides an excellent example of this concept here and I'm sure that a cursory search of SO will turn up quite a few examples as well.
From that point it is a matter of identifying the imported data and it's corresponding location in the workbook.
If you have an example I would be happy to look at it...

Related

How to get specific cell contents of an Excel sheet at another sheet dynamically?

I have an Excel file including thousands rows as follow. First column includes names and second column include group of each. I want to have all names belong to group "A" at another sheet dynamically. because name and group list may be changes. In other words, what command or function I should use to list all names belong to group "A"?
There are 3 ways to do this. The options are below. One thing you did not include in your question is what the results should look like.
Equations like =FILTER(A:B,B:B="A")
Pivot tables to use this convert data to table, then create pivot table. This requires refresh when new data is added.
Power query to use this convert data to table, then go to Data>From Table/Range. This requires refresh when data is added but you can change the "connection properties" under Data>Refresh AllĖ….
Now if you want all in group "A" to be listed with in one cell, then I would use option 3 with groupby as talk about here.
If the answer works for you the expectation is that you checkmark it and upvote it. If the answer does not work for you add a comment at the bottom and the problem you experience. For your situation you will need to adapt the answer.

One Slicer that filters multiple slicers/tables (Mac friendly solution)

I have an excel file (teams scores) with 3 different worksheets (Performance, Mood, Client Surveys). Each worksheet contain a different table but all 3 tables have a common Column called "Team Name".
Objective: The objective is to have Main Slicer that will be able to filter all the tables (and connected pivots/charts/Slicers) by Team Name.
What I did: I've created a Data model containing all the 3 tables (and the related pivots/charts/Slicers within the data model). I have created a new table containing unique Team Names (with a connected pivot and slicer) and made a relationship between each table and the unique one.
Everything was working as intended. When I filtered Unique slicer it was automatically filtering all pivots/charts/Slicers in all worksheets.
The Problem: I have some users with Mac pc and Data Model does not work on their excel version.
The Question: Is there a way (normal excel or VBA) to reach the same result but Mac friendly?
Many thanks for your help.
Sheet1 (Performance)
Performance
Team Name
Fast
Team 1
Slow
Team 2
Average
Team 3
Sheet2 (Mood)
Mood
Team Name
Sad
Team 1
Happy
Team 2
Happy
Team 3
Sheet3 (Client Survey)
Mood
Team Name
Good Job
Team 1
Bad Job
Team 2
Neutral
Team 3
While I am not very familiar with using VBA on a Mac, I will tell you how I would solve this in a windows enviroment.
Create a slicer for the first table.
Add a formula with a subtotal (max) or something, to get the team name that is currently selected, displayed in the cell.
Create VBA code that sets the filter on the other two tables, using the cell with the formulas as the filter criteria.
Create an on change event to fire the code. This will depend on how the rest of your spreadsheet is set up as for what to trigger the macro.

Excel 2010: Automatically combine multiple tables into one dataset

I thought there would be a simple way of doing this, but unfortunately I have not come across one. My company has an Excel workbook with 12 sheets (1 for each month), into which I enter sales data as accounts are written. I reformatted each month's data into tables, thinking that this would provide an easy reference to gather the data into a pivot table that joins all the months and would be updated as I enter data; however, a pivot table based on multiple sets of data allows highly limited manipulation.
So what I want to do is create a new table that is automatically populated as I enter data in any of the 12 current tables, to combine them into a master listing. I have tried doing a query, but when I try to set up the data sources, it doesn't recognize my tables. I tried Power Query, but I couldn't get it to update the data as I updated the source. Consolidate also was not a useful feature, as it required all the data to be somehow calculated, and my columns need to simply be copied over, not summed or averaged.
As you can probably tell from my explanations and terminology, I'm no Excel expert. I don't know what VBA even is, let alone know how to use it, but I've seen it mentioned a lot, so I figure at some point in my life I should learn it.
Is there a formula or some other Excel 2010 feature that can automatically copy all of this data onto one running list, and keep it updating as I enter data in the source tables? It would have to run automatically.
I believe your end goal is to have a pivot table which consolidates data from each of the individual 12 sheets/tables and not really to have the intermediate "single running list which is an aggregation of all the 12 sheets".
If so, I suggest to create an Excel Pivot table directly based upon the 'Multiple consolidation ranges'.
To start, create a new spreadsheet and select a cell (say A3) and use the click sequence Alt+D+P, this will bring up the PivotTable and PivotChart Wizard, and proceed further using the third option - 'Mulitple consolidation ranges'.
I will have to refer you to the below site for a detailed step by step instructions on the above: http://www.contextures.com/xlPivot08.html
Please be aware that the Difficulty level for this solution is Medium, suggest you to bookmark the solution from maintainability reasons, in case you choose to implement it.

How to create a dropdown list on excel that filters a table?

I have a table with the following headings on Sheet 1:
List of Areas-----List of Defects
And a table like the following on Sheet 2:
Area-----Defect-----Cause-----etcetera
I want to create a dropdown list on Sheet 2 for defects that refers to the table on Sheet 1 and shows only the defects for the respective area.
The problem is that there are a lot of areas and each area has many defects, so for example Area A may appear 10 times on the first table.
What have I already tried?
Creating a sepearate table for every Area, however there are too many areas and it is not worth it
Creating a named range, however, new defect will be constantly included on the first table
I also tried the =OFFSET(INDEX(Table1;MATCH(F5;Table1[List of Areas];0));;1;COUNTIF(Table1[List of Areas];F5)) combined with the indirect command.
However given that the tables are in diferent sheets i cannot acces them.
How can I fix this?

Create new sheets based on roster and auto calculate completes

Okay, Im setting up a spreadsheet that will track employee progress. Im new to vba and macro programming in excel but am not foreign to programing in general. Any assistance would be greatly appreciated. What I want to do is as follows.
Start off with 3 sheets (roster, log, Total) The log sheet will have all the tracking metrics of each employee.Total will Total each employees log sheet together and roster will be a dynamic employee list. As a new entry is created in roster then I want to copy the log sheet and rename it by the name put into roster and add the new (named) sheet into the Totals calculations.
For arguments sake just say that each log sheet only has a numerical value in a1 and total is just tallying all log sheets a1 fields. Roster contains just a first name in column A and no other data. (Given direction I should be able to expand the concept to a more intricate set of sheets.
Additionally it would be interesting to be able to remove a name from roster and have the said log sheet be deleted and removed from the totals formula... :D
Again Thanks for any assistance.
I have seen people try to make excel work like a database and it is ultimately doomed to failure. As this is a green field project I would start it right and use some sort of database. The choice is yours depending on your skillset, hardware available and what it will be used for. A good starting point would be good old MS Access, it is quick to learn and in the right hands very powerful. If it is going to be higher use then maybe look to a server based data store such as SQL server and write the front end in anything you want (Access, vb.net, asp.net etc)
The point here is choosing the right tool for the right job, spreadsheets have their place but databases they are not

Resources