# Solved: Auto expand X-axis in Excel graph



## ronyace (Apr 4, 2004)

Hello,
I have an excel sheet that is used to generate a graph. The data for the graph (columns) can be anywhere from 5 to 2000 data points. I set up a graph template that will graph whatever data I have from cells A2:A2001. My problem is: If I have only 10 data points, my x-axis will still be 2000 spaces long. If I put in zero or N/A# it will show up as either N/A# or blank or (0), based on the property I set for diplaying zero values. How can I get the x-axis to auto scale to only show the number of data points I have. 

I will attach a sample sheet.

Thanks for you help.


----------



## slurpee55 (Oct 20, 2004)

redid some of your formulas....I don't do charts much, so....


----------



## ronyace (Apr 4, 2004)

:up:Thanks, I found the answer in an Excel help book. I had to define named ranges and then use the offset and count formulas. I never would have thought it was possible but it works great. I will mark this as closed. If you want to see my updated chart let me know and I will post it. I would post the solution but it took several pages of the book so it might be difficult to summarize. After quick google search, this site looks like it may have the answer if anyone reads this again.
http://www.meadinkent.co.uk/xlgraphoffset.htm


----------

