Dynamic Chart Ranges based on Drop Down List Selection

Orion19

Board Regular
Joined
Dec 18, 2017
Messages
56
Hi All!

I have two drop down menus consisting of dates using the Data Validation method. I'm trying to get the X axis to update based off of the input from those drop down menus. For example, if the user selects 11/1/17 and 12/1/17 the graph should update on the x-axis to reflect that range.

I can get this working by naming ranges for my dates (named "Dates") and frequency (named "Frequency") values. From there I name ranges using the following formula to define values on the x-axis:

=INDEX(Dates,MATCH(Home!$A$7,Dates,0)):INDEX(Dates,MATCH(Home!$A$9,Dates,0))

I set the formula above to equal a range name "chart_Dates". Then, while selecting data for the graph, I enter the following:

"Horizontal (Category) axis labels: =Home!chart_Dates"

I repeat the process for y-values by updating references accordingly.

When I do that manually it works just fine. However, when I try to record the process with the macro recorder none of my changes to the horizontal axis come up. I've entered the following code to change the horizontal axis programmatically, and the range is changed accordingly, but the graph doesn't respond to changes from the drop down menu.

Code:
cht.Chart.SeriesCollection(1).XValues = "Home!chart_Dates"

Ultimately, I'm trying to define the range for the x and y axis programmatically without breaking the charts ability to automatically update based on the dropdown menu dates. Here is a sample of my data set. Thank you in advance!!

ABCD
111/1/17DatesFrequency
212/1/1711/1/17
1
311/2/170
411/3/175

<tbody>
</tbody>

A1 = Dropdown list with 11/1/17 selected
A2 = Dropdown list with 12/1/17 selected
Column C continues until all dates are listed
Column D continues and matches the frequency for dates in column C

In this example the graph should only show dates (x axis) and frequency (y axis) between 11/1/17 and 12/1/17. Ideas and suggestions are appreciate!
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

Forum statistics

Threads
1,214,985
Messages
6,122,602
Members
449,089
Latest member
Motoracer88

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