Create your first interactive chart in Excel
Ever wanted to make a cool, snazzy interactive chart in Excel? Something like this:
In this tutorial, learn all about making your very first interactive chart.
Interactive chart in Excel – Tutorial
There are several ways to make an interactive chart in Excel. You can use data validation, form controls, slicers, timelines, VBA or hyperlinks. In this tutorial, learn how to make an interactive chart with data validation and slicers. For other techniques, refer to resources section of this post.
Interactive chart with Data Validation
Let’s say you are the product manager at Billette consumer care. You are looking at historical order quantity data for various products. Your data looks like below:
Making one chart with all of this is going to be very busy and hard to read. You want to make a dynamic or interactive chart so your boss can choose which product she wants to analyze and understand the order trend.
Step 1: Make a list of all choices
- Select all the product names and go to Namebox (top left corner) and type a name like products.
- Alternatively, you can also list the product names in a separate range and give that a name.
Let’s say we have the products in the products name.
Step 2: Set up selection mechanism
- Decide which cell will have the user selection. Let’s say this is Q5. Select the cell and go to Data > Data Validation.
- Change validation criteria to Allow > List.
- Type products in the Source. Click ok.
Now, we have way to select product in the cell Q5.
Step 3: Find out which product is selected
If we want the name of the product selected, we can simply use =Q5. For the rest of calculations, we need the number of the product (ie what is the position of the selected product in products). For this, we can use MATCH formula, like below.
Type this MATCH formula in an empty cell like I3.
=MATCH(Q5, products, 0)
This will return a number, matching the product user has picked.
Step 4: Calculating order quantity to show in the chart
Now, assume we have the number of product selected in cell I3. Given this, we can calculate picked product’s quantity using a simple INDEX formula:
=INDEX(data1[@[Soap]:[Deodorant]],$I$3)
======================
my (=INDEX(Table5[@[a]:[d]],$F$2))
to use $F$2 to use only this box value count
====================
If your data is in a normal range, rather than a table, use a formula like this:
=INDEX(C6:H6,$I$3)
Fill down the formula.
Now that we have calculated product quantity values for selected product, if you change I3, you will see values for the relevant product.
Step 5: Create the chart
Now that all the background work is done, let’s insert a chart.
Simply select picked product column and insert a column or line chart. We get this:
First, let’s add axis labels. Right click on the chart and go to select data. Edit horizontal / category labels and select the month column.
Now, remove chart title and chart border (set it to no line). We end up with something like this:
Step 6: Bring everything together
Are you ready for the chart? We are almost done. We just need to bring everything together and our first interactive chart will be kicking and beating.
- Position the chart under cell Q5 (the data validation selection cell)
- Go to Insert > Shapes > Rounded Rectangle and draw a nice big rectangle around the chart and Q5.
- Remove fill color from the shape and adjust the line.
- Now, when you pick a new product from Q5, your chart will update.
Interactive chart with Pivot Table and Slicer
If you are too shy to INDEX + MATCH on weekdays, you can try the Pivot Table approach. This works very well and let’s you make equally amazing interactive charts. See below quick demo.
Keep in mind that your data needs to get fit. Rearrange so it looks like this. If you need help, read: Unpivot data quickly with Power Query.
Step 1: Insert a pivot from your data
Select your data (month, product and quantity columns) and insert a pivot table.
- Add Month to row labels area. In newer versions of Excel, this will create date hierarchy – Year, Quarter and Month. If so, drop Quarter.
- Add Quantity to values area.
- Right click on Product and add it as a slicer.
Step 2: Insert a pivot chart
Select any cell inside the pivot and go to Analyze ribbon > Pivot chart. Select either a line or column chart.
We get this:
In newer versions of Excel, you can insert a pivot chart directly from data. But I find the pivot table first approach better as you can adjust items you want before charting.
Step 3: Format the pivot chart
- Select the pivot chart and go to Analyze ribbon and turn off Field Buttons.
- Replace chart title with “Total Order Quantity in last 13 months” or something like that.
- Set chart border to No line.
- Position the slicer adjacent to the chart.
- Draw a rounded rectangle around the thing
- Our interactive chart is ready for play.
Optional makeup hints:
If you want more bang for your chart,
- Add a sub-title describing the trend. Refer to download example file for inspiration. Read: Give descriptive titles to your charts
- Set limits on the vertical axis. By default Excel will change Y axis limits whenever your pick a product. This can create some distortion of the numbers and confuse your users if they want to compare products. You can format the axis and set limits. Select the axis, press CTRL+1 and set minimum to 0 and maximum to highest possible value (rounded of course). For our example, this could be 2000. This way, only bar heights change, not the axis.
- Adjust gap width. Excel would pick some ridiculous value like 219%. Adjust this to 100% or something like that for less white space on the chart. To do this, click on the columns, press CTRL+1 and from Series options adjust the gap width.
- to download this excel = link click hear
Company understands work-life balance and respect that. type of this blog nice :)
ReplyDeleteCompany provides regular communication, listens to and considers new ideas, and continuously encourages growth personally and professionally.
ReplyDelete- You get to work with top thought leaders - smart, collaborative, and willing to share.
- Flexible working hours and adaptive work environment.