# Change x Axis in Dynamic Chart According to Data Displayed



## Simonc64 (Dec 16, 2022)

Morning All, hopefully someone will be able to give me the final piece of my puzzle!

I have created a chart using a named range and different data is selected using a drop down list. This very nicely shows monthly activity for the last year.

However it occurred to me that my user might want to see just the last 3 months, or the last 6 months of activity. So I have amended the data source and everything works fine EXCEPT that the chart still plots the full 12 months on the x axis - so I have a chart with 12 months bit where only 3 show activity. What I would like to do if possible is, when i choose 3 months data (say Apr - Jun, i need the x axis to show Apr - Jun and not Apr - Mar, or if i choose 6 months to display (Apr - Sep) the x axis shows Apr - Sep not Apr - Mar.........and so on.

To keep it simple i want to keep the data at 12 months or 9 months or 6 months or 3 months but with the x axis changing accordigly.

Any help gratefully recieved - thanks !

Simon


----------



## rlv01 (Dec 19, 2022)

Let's say it's an XY plot , your X axis is the time axis and you have 12 months of data. If you want to plot a narrower date range, you do it by setting the .MinimumScale and .MaximumScale properties of the X axis (category axis).


----------



## Simonc64 (Dec 21, 2022)

Thanks for the suggestion, I eventually foumd a way of doing it via using OFFSET and MATCH


----------

