Create a Dynamic chart with 2 data set but can switch between different data to display in the chart

TinyExcel

New Member
Joined
Oct 14, 2021
Messages
4
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
  2. Web
Have been trying to figure out how to create a dynamic chart where I can switch between different datasets to display in the chart.

example the below. where I have 3 columns data in the chart. is there ways to create like a control the display of data, where i can just compare A and C and turn off B or even add anothe data set "D" without trying to edit the chart filter? but using like a dropdown list?

1647115829833.png


Would appreicate some help. :)
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Oh! What a coincidence! I worked on this kind of dynamic chart this friday. I am sharing the link for the file. check it out!
Link: dynamic chart try v3
Password: dynamicChartV3
Nuances:
Please look at the named ranges
Look at the VBA code
- It's a one-liner to refresh the chart data source
- I have written the code in the "summary" worksheet and it is set to run the code everytime you change the axis labels or series in the chart
- Currently you have to input these in the range "D27:Y28"
I tried to make it dynamic, but I think few other aspects can be made dynamic in the current version
Let me know in case of any queries.
 
Upvote 0
@mannem_teja Please post the code you are using to the thread, as per Rule#4.
Please do not answer questions by creating solutions elsewhere and then referencing those solutions via file links.
Thanks
 
Upvote 0
See my setup below. The original data is in the top part of the worksheet, in A1:D9.

I've added form checkboxes from the Developer tab. If you don't have the Developer tab, right-click in the ribbon between buttons, and choose Customize Ribbon. In the dialog, the list on the right shows the ribbon tabs. Check the box for Developer.

You can use Form checkboxes or ActiveX checkboxes, but keep in mind that ActiveX checkboxes only work in Excel Desktop for Windows, and even there they might be a bit flaky.

I have the checkboxes aligned with row 11. I have linked each checkbox with a cell in row 12 (B12 for "A Share" etc.). If the box is checked, the linked cell will contain TRUE.

I have a working version of the data below that. The first row and first column are just pasted, but cell B15 has this formula:

=IF(B$12,B2,NA())

This formula is filled into the entire range B15:D22.

If a checkbox is checked, then its linked cell is TRUE, and the value is taken from the original data above. If the checkbox is unchecked, the linked cell shows FALSE, and the cell contains #N/A, which will not be plotted (though it still appears in the legend).

The chart is made from this second range, in A14:D22.

DynamicChartCheckboxes1.png


This is what it looks like when the B Share checkbox is unchecked:

DynamicChartCheckboxes2.png
 
Upvote 0

Forum statistics

Threads
1,214,975
Messages
6,122,538
Members
449,088
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top