add labels to non-zero elements in stacked column chart Excel 2013 - excel

I'm generating a stacked column chart out of an a table like this:
Year 1 2 3
A 50 0 0
B 50 0 0
C 0 100 0
D 0 50 0
E 0 0 10
F 0 0 15
I want column stacks for every year, with series labels for every non-zero value. Currently if I try and add labels then I get 6 labels for every series (with the zero values clustered around the axis). How do I generate series labels for all non-zeroes? I am happy to rearrange my data to a different format to the table above. I am using Excel 2013.

You can throw an error to replace the zeros in your data. That way they won't appear on your chart. You can use:
=NA()

Related

Hide Text Axis and Have Chart Readjust in Excel

I have the following table in excel:
A B C
1 Object 1 100 100
2 Object 2 0 0
3 Object 3 100 100
4 Object 4 0 0
When I create a stacked bar chart with this values I get the following result:
Stacked Bar Chart 1
I need to figure out a way for the chart to adjust automatically and exclude any object for which both columns B and C have 0 values. In this case Object 2 and 4. Numbers will flow automatically into my template and I will not be able to manually update the charts. The end result with my example should look like this:
Stacked Bar Chart 2
I appreciate all the help.

In Excel aggregate values from a column if the following values are larger than zero

I would like excel to iterate through a column of precipitation values and keep adding them as long the value is larger than zero. The table for example looks like this with the required result in NewCol.
Date prec NewCol
x 10 10
x 8 18
x 3 21
x 0 0
x 1 1
x 0 0
I would like to use the value 21 (and all other values with largest values) to assess consequtive rainfall days. Wondering if this is possible in Excel? Haven't been able to find the solution in Mathlab.
Thanks in Advance!

Excel Pivot Drilldown on Sums of Flags

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.

EXCEL Count number of weeks in month based on date

I am trying to look up a value in a matrix based on a given date. The matrix has the first day of the week along the vertical axis, and the first day of the month along the horizontal axis.
For a given day, e.g. 31/08/15 I would like to match the exact date to the vertical axis of the matrix (i.e. 31/08/15), and the month to the horizontal axis (1/08/15).
So in the example below, an input of 31/08/15 should provide an output of 3.
01/06/2015 01/07/2015 01/08/2015 01/09/2015
03/08/2015 1 0 0 0
10/08/2015 0 2 0 0
17/08/2015 0 0 3 0
24/08/2015 0 0 0 4
31/08/2015 0 0 3 0
I am trying and failing with index and match formulae.
I have tried the following:
=index(area where to look, match(31/08/15,first column,0),match(and(month(31/08/15),year(31/08/15)),(and(month(first row),year(first row)),0)
Hope this is clear, thanks!
You can use an INDEX function with two MATCH functions top supply both the row and column.
    
The formula in D8 is,
=INDEX($B$2:$E$6,MATCH(C8,$A$2:$A$6,0),MATCH(DATE(YEAR(C8),MONTH(C8),1),$B$1:$E$1,0))
I'm a little concerned about the dates matching exactly down column A but a little maths manipulation with the WEEKDAY function would take care of that.
=INDEX($B$2:$E$6,MATCH(C9-WEEKDAY(C9, 2)+1,$A$2:$A$6,0),MATCH(DATE(YEAR(C9),MONTH(C9),1),$B$1:$E$1,0))
Here you go:
=INDEX($B$2:$E$6,MATCH(DATE(2015,8,31),$A$2:$A$6,),MATCH(DATE(2015,8,1),$B$1:$E$1,))

heatmap with category data

I'm trying to draw a heatmap via gnuplot. The problem is: how to accumulate data with gnuplot.
Starting with one dataset:
0 0 0
0 1 1
1 0 2
1 1 3
that can be easily plot via
set view map
splot 'test.data' using 2:1:3 with image
The problem is: there is not only one dataset, but many. See this example data:
0 0 0
0 1 1
1 0 2
1 1 3
0 0 3
0 1 2
1 0 1
1 1 20
It has repeating x/y-values. Is it possible to use gnuplot to sum up the third column (the "data-column" like displayed here:
0 0 0 0 0 3 0 0 3
0 1 1 0 1 2 0 1 3
1 0 2 + 1 0 1 = 1 0 3
1 1 3 1 1 20 1 1 23
My first idea was to use every like in plot 'test.data' using 2:1:3 every 4 with image. But this doesn't work. Does anyone have an idea how to do this?
For the interested ones: i want to plot a heatmap of my fitbit data:
https://gist.github.com/senfi/c0d13a2c91fae13bc5f5
This file contains nine weeks of counted steps i made. the first column is the day of the week (sunday to saturday). The second column represents 5-minute-steps through the day starting at 0:00am. Plotting a single week looks nice, but plotting the sum/average of the last two years may look pretty awesome. Of course, i will post a picture, if we figure it out how to plot this. Feel free to use the steps-data.
This looks like a job for awk to me. awk can be called from within gnuplot like this:
sp '<awk ''{a[$1,$2]+=$3}END{for(i in a){split(i,s,SUBSEP);print s[2],s[1],a[i]}}'' test.data' w image
The awk script accumulates the value of the third column into the array a. The key for each value is the string [$1 SUBSEP $2] (equivalent to [$1,$2]). $N is the value of column N. SUBSEP is a built in variable whose value we don't need to worry about, we just refer to it again later.
When the whole file has been read (the END block), split is used to recover the first two columns by breaking up the array keys. The two parts of the key are printed, followed by the accumulated value. I rearranged the column order in awk as well (print s[2],s[1],a[i]) so that back in gnuplot, using 2:1:3 is no longer needed.

Resources