Dynamically Change Chart Rate Based on Option Button Selection - excel

I have been trying to dynamically change the range of a stacked bar chart to adapt to different selections of three option buttons. My table is arranged from J1:M14. The top line contains the headers for each column. The first column (J) contains a descriptive column. The actual data is contained between columns K and M. One selection of the option button results in the range of the data expanding to J1:M15. So, based on the option button selection, the number of rows in this table increase, but the number of columns remains fixed.
I want to create a stacked bar chart that displays each of the stacked bars for each descriptive label in column J. With a different selection of the option button, the stacked bar chart will either extend to include the extra label, shrink to remove the extra label, or keep the same length.
What is happening: The range is fixed and will not change. When I select the option button, the range does not shift based on the data range.
What I have tried: Under formulas-->Name Manager, I have created four new names:
1.) DatainColumnK: =OFFSET(Calculations!$K$2,,,COUNTIF(Calculations!$K$2:$K$100,"<>"))
2.) DatainColumnL: =OFFSET(Calculations!$L$2,,,COUNTIF(Calculations!$L$2:$L$100,"<>"))
3.) DatainColumnM: =OFFSET(Calculations!$M$2,,,COUNTIF(Calculations!$M$2:$M$100,"<>"))
4.) DescLabelColJ: =OFFSET(Calculations!$J$2,,,COUNTIF(Calculations!$J$2:$J$100,"<>"))
Next, I selected the entire range of the data --> Created a stacked bar chart --> Clicked Select data --> Added three new series in the Legend Entries by editing series and only entering in TabName!DatainColK, TabName!DatainColL, TabName!DatainColM and then editing the axis labels by adding in TabName!DescLabelColJ.
Is there something I'm missing?

Related

Dynamic chart in Excel that show user-selected time series

I'm trying to create a chart in Excel (without VBA) where the user can select which time series are shown in the chart. My issue is that I can't figure out how to do this without VBA.
For example, I want to create a chart where the user can decide which of the time series Bananas, Apples and Oranges to show in the chart by marking them with an x (data is in sheet called Fruits). Any suggestions how to make this work? I tried to make an if-statement and link the cell to chart (e.g. IF(A2="x",B2,"") but this doesn't work.
X-values Y-values Show
Fruits!Banana_date Fruits!Banana_sale x
Fruits!Apple_date Fruits!Apple_sale
Fruits!Orange_date Fruits!Orange_sale x
Two ways.
First: In Excel 2013 and later, there are three small "skittles" floating beside the chart. The third is a filter button. Click it, and you get checkboxes for the series and for the categories. The user can check and uncheck to display what they want.
Second: Set up the data like shown. Column A has the Dates. Columns B:D have the raw data for apples, bananas, and oranges.
I've placed checkboxes over cells B2:D2 (Developer tab > Controls > Insert > Form Controls > Checkbox. Each checkbox uses the cell above it as its linked cell.
Columns E:G have the plot data for the fruits. In cell E3, the formula is =IF(B$1,B3,NA()), and this fills the rest of these rows and columns.
Select A2:A19, then hold Ctrl while selecting E2:E19, so both areas are selected, and insert a line chart.
When you uncheck a checkbox, the cell above it changes from TRUE to FALSE, and the corresponding plot data column fills with #N/A values, which will not be plotted in the chart.
You can make graph from temp table with =if(show=1;vlookup(X;X-Y;2;"")) and make graph from temp table.
Excel

Non out-of-the-box chart in Excel

We have a particular chart that we like using. I saw it in a book by Stephen Few:
The blue series is actually a line chart with markers: the markers have been expanded and the line has been deleted.
So it is not an out-of-the-box Excel chart but rather a bit of a hack.
What I don't seem to be able to do is spin it on it's side. So if I draw in the second series this is what I'm trying to achieve:
I'm happy either just hacking the chart wizards or using a vba solution.
To get this type of chart you need three columns of data, plotted on two axis, and build the chart in stages.
First, your data should look like this:
Next, select A1:B4 and Insert and Stacked Bar Chart to get this:
Now, select C1:D4 and Copy, then select your chart and Paste Special (add cells as New Series; Values in Columns; Series Names in First Row) to get this:
Excel just changed your chart type to a simple Bar Chart, but you still want a Stacked Bar Chart. So right click in the chart and Change Chart Type to Stacked Bar.
You'll notice that the scale of your primary axis is not showing what you need. In order to solve this, we'll move the two "Prev" columns to the Secondary Axis.
So, show the Format ribbon and in the upper left corner drop down menu select "Series PrevMthInvis", then click the Format Selection button underneath the drop down. In the Format dialog under Series Options, choose Secondary Axis. Then under Fill, select No Fill.
Back to the Ribbon and select "Series PrevMth" and Format Selection again. Select Secondary Axis, and change the Fill color to your desired value. Finally change the Gap Width to 50%.
At least in my Excel chart, the series are not in the correct order. You want the "PrevMth" series to be stacked on top of "PrevMthInvis", so right click on the chart and choose Select Data, then move the series to be ordered Mth, PrevMthInvis, then PrevMth.
The final clean up involves right clicking the secondary axis (the upper horizontal axis) and making sure the scale, min, and max matches the primary axis, then set Major and Minor Tick Marks and the Axis Labels to "None". Lastly, select "PrevMthInvis" in the legend and delete it.
You can change the width of your blue "bar" by changing the "PrevMth" value to 0.5 or whatever is best for you. Good luck!

How to plot columns on a chart when one column contains large values and the others small

I want to make a bar chart in SSRS and my table contains multiple columns. One column contains large values over 100 while the others contain values between 1 and 10. The other columns are pressed by the large columns. I multiplied the other columns values by 10 but I am not sure if this is the right way to make them visible. Please suggest.
If you can get away with multiplying one value by a factor then it makes some sense to do this. Depending on what you are trying to achieve, I would consider having the larger values as columns and then the smaller values as a marker on the secondary axis. A step by step guide to do this is below, assuming you have the current column chart created.
Right-click on one of the columns of the smaller valued data set on the chart
Select Change Series Chart Type.. and change it to a line graph
Click on the new created line
On the Format tab, under the Current Selection grouping, click Format Selection.
In the Format Data Series dialog box, on the Series Options tab, select Secondary Axis
Still within the Format Data Series dialog box, on the Marker Options tab, select a style of marker you would like to use, as well as the fill of the marker on the Marker Fill tab
Under the Line Color tab select No line
Click Close in the corner of the dialog box
This will create a chart similar to the below.
For your requirement, I think it's better to use scale break to make a better view.
https://technet.microsoft.com/en-us/library/bb934379(v=sql.100).aspx

stacked bar chart custom format

I have a stacked bar chart in excel. This is made up of positive and negative comments. I can get the negative topic names down one side of the axis but can't work out how to get the positive down the right hand side of the chart?
From the example attached I want the axis titles on both the left and right of the graph? I've been stuck on this for a few days and have researched this.
Thank you in advance for any help!
What you can do is:
Add a new series of data plotting a value of 0 for each category, and using your "good" labels for the category axis data.
Format the new series to plot on a secondary axis
Add a secondary vertical axis, and format it to display the categories in reverse order
Demo file here: http://1drv.ms/1xrnjBg
Alternative that may be more robust because it doesn't mess with primary and secondary axes...
Here is the data, with bad label captions, bad percentages, good percentages, and good label captions. I've inserted a column of zero values between good ercentages and good label captions.
I selected A1:D5, that is, the whole data range excluding the good label captions, and then inserted a stacked bar chart, shown below the table. I've reversed the direction of the categories on the vertical axis and changed where the horizontal axis crosses to the maximum category, so the items are in the same order as in the worksheet. I also deleted the legend and adjusted the plot area to provide room in the right margin of the chart for the labels.
I selected the "blank" series (by clicking the green series, then clicking the up arrow key), and added data labels, shown in the second chart.
I formatted these data labels in the third chart so that they are in the Inside Base position, which moves them outside the plot area.
In the fourth chart I used the Values from Cells option to the data labels, and selected the range of labels in column E. This isn't available before Excel 2013, but you can change the labels in a number of ways:
Select each label individually (click once to select all labels, click again after a slight pause to select each specific label), double click on the text of the label, and overtype it with the text you want to show.
Select each label individually (click once to select all labels, click again after a slight pause to select each specific label). Don't go into edit mode: you don't want the cursor flashing in the label. Type = in the formula bar, then click in the cell with the desired label. This is a link to the cell, so changing the cell contents will change the displayed text in the label accordingly.
Use Rob Bovey's Chart Labeler, a free Excel add-in from AppsPro.com.

Using named "Chart Data Ranges"

I am trying to build a chart which dynamically updates the series' selected based on user-defined selections from a drop-down menu.
Purpose is to create chart which displays n-series of data based on n-selections, e.g.
=Output!$P$36:OFFSET(Output!$O$35,IF(Output!$C$4="RANK",COUNT(Output!$S$34:$S$38),COUNT(Output!$S$34:$S$38)+3),COUNTA(Output!$P$35:$W$35))
The named range dynamically updates the chart area (i.e. row labels, column labels and data range). I reference it correctly i.e. as ='filename.xlsm'!named_range_here in the "Chart Data Range" section.
When I do this, the Chart Data Range resets itself [help]
How can I tell excel to stop showing blank series (e.g. 2 blank series of 5 when i want it to display the 3 series which have values) [ideas please]
When you apply a Name to the entire chart source data range, it is converted into its address. To keep dynamic Names, you need to define a Name for each distinct X and Y value range, and insert these into the respective series formulas.
If you're not shy about VBA, you can still make it work, following the approach in my tutorial Dynamic Chart Source Data.

Resources