Author: Oscar Cronquist Article last updated on October 01, 2018

This interactive chart allows you to select a country by clicking on a spin button. The chart and table shows selected country.

I have made something very similar in year 2013, Highlight a column in a stacked column chart but with vba. This article explains how to build and make it work without vba.

Build a spin button (form control)

1. Go to tab "Developer" on the ribbon
2. Click "Insert" controls button
3. Click "Spin Button" in group "Form Controls"
4. Click and drag on sheet to create a spin button

Configure spin button

1. Right click on spin button
2. Click "Format Control..."
3. Go to tab "Control"
4. Change the maximum value, if you have 10 countries use value 10. 20 countries use value 20..
5. Select a cell to link the spin button to.
6. Click OK button

Show selected country on sheet

1. Go to cell C14
2. Type this formula: =INDEX(Table13[Country],D14)
3. Press Enter

The value changes in cell C14 when you click the spinnbuttons. The spinnbutton is linked to cell D14. The formula in cell C14 then uses the value in cell D14 to get the country name in column Country in table Table13. The value is shown in cell C14.

Conditional formatting applied on excel table

1. Select all values in the excel table
2. Go to tab "Home" on the ribbon
3. Click "Conditional formatting" button
4. Click "New Rule..."
5. Type in "Format values where this formula is true:" =\$C\$14=INDIRECT("Table1[@Country]")
6. Click Format..." button
7. Pick a color
8. Click OK button twice

This formula =\$C\$14=INDIRECT("Table13[@Country]") compares the value in cell C14 with each of the values in column Country, Table13. If a value is a match the entire row is highlighted.

Copy table and new formulas

1. Copy table13
2. Paste it next to table 13 but keep at least one blank column between tables.

(
Click to enlarge)
3. Delete all values except headers in the new table
4. Select the first cell (I3) in the new table and type: =IF(Table13[@Country]=\$C\$14,Table13[@Country],""). You donยดt need to copy the formula to cells below, the table takes care of that.
5. Cell J3: =IF([@Country]<>"",Table13[@[GDP (nominal)]],"")
6. Cell K3: =IF([@[GDP (nominal)]]<>"",Table13[@[GDP per capita (nominal)]],"")
7. Cell L3: =IF([@[GDP (nominal)]]<>"",Table13[@Agricultural],"")
8. Cell M3: =IF([@[GDP per capita (nominal)]]<>"",Table13[@Industrial],"")
9. Cell N3: =IF([@[GDP per capita (nominal)]]<>"",Table13[@Service],"")

(
Click for larger picture)

We are using the second table to populate the second series in a chart. If this doesn't make sense to you, donยดt worry.

Insert a column chart

1. Select table13 data
2. Go to tab "Insert"
3. Click "Column Chart" button
4. Click "Stacked Column" button
5. Right click on chart and click "Select Data..."
6. Remove GDP (nominal)
7. Remove GDP per capita (nominal)
8. Click OK

This is what the chart looks like now.

Color all stacked columns

1. Right click on a column
2. Click "Format Data Series..."
3. Click "Fill"
4. Click "Solid Fill"
5. Pick a color
6. Click on next column series on chart
7. Repeat step 3 to 5 with all remaining column series

1. Right click on chart
2. Click "Select Data..."
4. Add series "Agriculture", "Industrial" and "Services" from the second table (not table13)

Plot series on secondary axis

1. Right click on one of the new column series
2. Click "Format Data Series..."
3. Click "Plot Series On Secondary Axis"
4. Go to tab "Layout" on the ribbon
5. Select one of the remaining new series (Agriculture, Services and Industrial)
6. Repeat step 3
7. Make sure you have moved Agriculture, Services and Industrial series to the secondary axis

Delete secondary y axis

1. Select secondary y axis
2. Press Delete