Excel Pivot Drilldown on Sums of Flags - excel

I've been hitting a wall on this today. I'm pulling my data from a SQL DB and in my query I'm setting flags so that I can use the Pivot table to count up all the different checks I'm trying to run on the data. A simple version of what I'm doing would look like this is below with a Greater than 90 days and Error Check flags set depended on the data in Uptime.
Host Team Uptime >90 ErrChk
Srv1 A 15 0 0
Svr2 A 102 1 0
Srv3 B 95 1 0
Svr4 B 20 0 0
Srv5 B 21 0 0
Srv6 B ERROR 0 1
Srv7 A ERROR 0 1
Srv8 B 150 1 0
Srv9 A 100 1 0
Srv10 A 10 0 0
Srv11 A 125 1 0
Srv12 A 40 0 0
Srv13 B 111 1 0
Srv14 B 100 1 0
Srv15 A 15 0 0
If you were to plug this into Excel exactly the way that it is you will see what I'm getting at. Once you create a Pivot table on this data and use the Team as the Rows and the Sum of >90 and ErrChk the pivot comes out and looks correct.
Row Labels Sum of >90 Sum of ErrChk
A 3 1
B 4 1
Grand Total 7 2
But the next piece is where it gets wonky. With a Pivot table when you double click one of the values it filteres down on what makes that value, however when you do it on the value of a SUM, it just filteres down on the Row Label. So for this example you would click 3 under >90 for team A to see what the 3 servers are that have been up for longer thank 90 days. However when you do this it gives drills down to just a filter of team A showing you all of the servers, the good, the bad, the error.
My question is how can I drill down to just the items that make up that value? I've tried all I can think of, have the filed be NULL, 0, calculated fields.

I would suggest adding an additional pivot table for the view you want. For your example you might want to add Team, then Host to Row Labels. Then add Sum of > 90 to Values. Then add > 90 to Report Filter and set the filter to 1.
These pivot tables could all be on the one worksheet pulling from the same data source as a kind of summary and the filter would be preset so there would be no need to provide instructions to those viewing the summary.
If you'd like let users change the filter easily you could add a slicer which will present all options by which the data can be filtered by.

Related

Getting unique values in excel from table with multiple equivalent values

I am not an excel expert, but I have been searching for days on a method to repeatably pull non-zero entries from a 2 column table. The reason it has to be repeatable (and hence can't use filtering) is that I have about 50 pie charts with different data sets I need to create so that the charts only have slices that are greater than zero.
Here is an example of the source data, which I have pulled from a few thousand rows of raw entries
| Possession type observed | Count |
| ------------------------------|--------
|Handheld device 27
|Backback 53
|Baby stroller 5
|Walking aid 1
|Headphones 5
|Wheelchair or mobility device 2
|umbrella 1
|Bundle buggy 0
|book 0
|DVD 1
|purse & holding keys 0
|handbag 1
|clutch wallet 0
|white paper 0
|grocery bag 0
|purse 0
|holding newspaper 0
|None of these 83
I haven't found a satisfactory solution to build a pie chart out of the data above that removes zeros, so I went ahead and tried to create a summary chart only listing values > zero.
But my problem is that I can pull non-zero entries out, when it comes to the entries with the same value (e.g baby stroller and headphones both have a value of 5), I can't grab baby stroller, then headphones.
Ideally I would like the summary chart to look like this:
| Possession type observed | Count |
| ------------------------------|--------
|Handheld device 27
|Backback 53
|Baby stroller 5
|Walking aid 1
|Headphones 5
|Wheelchair or mobility device 2
|umbrella 1
|DVD 1
|handbag 1
|None of these 83
Thanks so much in advance for any assistance!
To get the desired output follow these steps:
Step1: Select the data
Step2: Choose pivot chart from insert tab,follow the wizard to create the pivot table and chart where you want them or hit Alt + D + P and 3 times enter
Step3: Change the chart type to pie from the Design tab
Step4: Drag the 'Possession type observed' field to the 'Axis' area
Step5: Drag the 'Count' field to the 'value' area as well as 'report filter' area
Step6: Filter out 0 using the dropdown on the chart

Automatically Organize data in a sheet differently (in order to create a dynamically updated graph)

I currently have this in sheet1 columns A,B,C:
Date Time Worker
04/04/2016 4,5 John
05/04/2016 2 John
06/04/2016 6,5 John
07/04/2016 0 --
08/04/2016 0,5 Charles
08/04/2016 2 John
08/04/2016 0,5 William
09/04/2016 0 --
10/04/2016 0 --
11/04/2016 9 John
11/04/2016 3,75 William
I want this in sheet2 columns A,B,C,D (or more in case of more names):
Date Charles John William
04/04/2016 0 4,5 0
05/04/2016 0 2 0
06/04/2016 0 6,5 0
07/04/2016 0 0 0
08/04/2016 0,5 2 0,5
09/04/2016 0 0 0
10/04/2016 0 0 0
11/04/2016 0 9 3,75
I need this because I need to make a graph and data has to be organised like this or I'm not able to create the graph!
The code (which i believe it's the only way) has to work with any given dates, times or worker names! Worker names in alphabetical order if you can.
I don't have any clue how to code this and it is giving me nightmares for weeks. Really need all the help for this one.
It's just a guess since you didn't say what the chart should display.
I am pretty sure you can create this chart without the second sheet and a macro.
Try this:
Format the Range containing the data as table ( Select Range, Home -> Styles -> Format as Table) When you add a new row this table will automatically extend.
Create a Pivot-Chart ( Select all cells in the new table, Insert -> PivotTable (the Name, not the symbol) -> PivotChart)
Choose a destination for the PivotChart
Click in the Pivot-Field and select your 3 entries
It should look like this (I filtered the "--" Workers):
Play around in the 4 fields (drag&drop) to fit it your style. If you add new rows simply right click anywhere in the pivot table and press refresh.
Edit: I forgot to mention that I did this in Excel 2010.

Calculate percentage using functions

I have an Excel workbook (Office 2010) that lists multiple different spreadsheets (offices) in our organization. We use this workbook to keep track of their "errors" in turned-in documents (example only). I'm trying to figure out a good way to determine, through automation (functions) the percentage of documents that have had errors in them. I want to determine the percentage of documents looked at versus the amount of errors, completely ignoring the amount of errors. So if I looked at 10 documents and 7 of those had at least one error, the office's percentage of errors would be 70%.
Is there any easy way to do this?
I've tried a few functions but I continue to get errors. I show a sample sheet (one office) below. This example is similar across multiple sheets and there is a dashboard that I would like to display all of these statistics based on offices.
workpaper DISCREPENCIES
Paper Spelling Grammar Punctuation Total Errors/Paper
A.36.7 1 0 1 2
A.36.8 0 1 1 2
A.36.9 0 1 0 1
A.36.10 0 0 0 0
A.36.11 1 0 0 1
A.36.12 1 1 1 3
A.36.13 2 3 0 5
A.36.14 0 0 0 0
A.36.15 0 0 0 0
A.36.16 1 1 1 3
Total Errors 17
Total Documents 10
Total Documents w/ errors 7
Percentage of Errors 70%
I can do all of this manually but I would like to find a way to do this across all sheets since there are a quite a few and output them to a "dashboard" that has all offices listed in rows.
One way is to look at the number of worksheets with 0 errors in them. Then subtract that percentage from 100%. For example in G5:
=COUNTIF(E3:E12,0)/COUNT(E3:E12)
and in G6:
=100%-G5

Finding the first ocurrence of a string below a given cell?

I've been trying to figure this out but I don't seem to get it right.
I have a spreadsheet with reports for different categories detailed by day (e.g. Toys, Drinks, General Store, Meat Store, Veggies, etc)
So, my spreadsheet looks something like this:
Toys
Day Me Wife Kid1 Kid2
9/28/13 0 0 0 0
10/1/13 29 3 0 0
10/2/13 0 7 34 25
10/4/13 0 0 0 0
AVERAGE 29 5 34 25
.
Drinks
Day Me Wife Kid1 Kid2
9/30/13 102 15 0 0
10/1/13 0 0 25 0
AVERAGE 102 20 0 0
etc etc
So the idea would be that I need to be able to find the Average row number for each different category, but I can't just look for it easily because in one category there might be expenses on more months (hence, more rows between the category's title and the average row). Any clues?
You can use
=ROW()+MATCH("AVERAGE",$A2:$A$1001,0)-1
The row reference to A2 is variable and you can paste it next to the category of interest. The row reference to A1001 is just far enough down in your spreadsheet to include all the data, and is fixed (but doesn't have to be).
You can use something like this perhaps:
=MATCH("AVERAGE",INDIRECT("A"&MATCH("Drinks",A:A,0)&":A1000"),0)+MATCH("Drinks",A:A,0)-1
MATCH("Drinks",A:A,0) returns the row number of Drinks
Which is used by INDIRECT and to convert into a range, from which MATCH then returns the number of rows after that header. Add to the number of rows before Drinks and remove 1 to get the actual row number.
Change the range of A1000 accordingly. I assumed a maximum of 1000 rows here.
Edit, if you have cross-sheet referencing, you need to change the formula to:
=MATCH("AVERAGE",INDIRECT("'Sheetname'!A"&MATCH("Drinks",'Sheetname'!A:A,0)&":A1000"),0)+MATCH("Drinks",'Sheetname'!A:A,0)-1
Assuming Sheetname is the name of that sheet.

Sum elements in matrix in Excel

id a b c
1 0 0 0
1 0 0 0
2 0 0 0
2 0 0 0
3 1 2 3
3 0 0 1
Given the above matrix, I want to create a new matrix, which sums the numbers within the first matrix for a given id in a given year (a,b or c). So for the above, it should look like:
1 2 3
a 0 0 1
b 0 0 2
c 0 0 4
Can anyone see what to do?
Try using SUMPRODUCT rather than SUMIFS, e.g.
=SUMPRODUCT(B2:D7,(B1:D1="a")*(A2:A7=1))
The formula solution given in the other responses will work well when data headings are already in place and the data range is not too large.
A pivot table creates the row and column headings for you and will update as new data is added when you click the Refresh Button, it's also significantly quicker when the data range is large.
Steps
A) Choose Insert | Table for your data range, and give it a suitable name, the default is Table1
B) Access the PivotTable wizard via the shortcut Alt+D+P (this is not on the default menus).
1) Multiple Consolidation Ranges
2a) I will Create the Page Fields
2b) Range: Table1[#All] Page Fields: 0
2c) Existing Worksheet: $A$7
C) Click Finish, switch Row and column fields and turn off totals and autoformatting
I suggest that you try solving that problem with pivot tables.
Here are 2 links that you might use to learn that feature:
http://www.cpearson.com/excel/pivots.htm
http://www.youtube.com/watch?v=7zHLnUCtfUk
The only drawback with Pivots is that if the size of the source range changes, the Pivot will not adjust automatically. So once you managed to solve your initial problem and understand the power of Pivot Tables, I suggest that you use a Dynamic Named Range as the source of your Pivot.
Edit:
I feel that barry houdini's solution is simpler. I reproduced it below (with all credit belonging to him!)

Resources