Automatic adjustment of Axis

Koejns

New Member
Joined
May 24, 2011
Messages
14
I have a question about automatic adjustment of the X-axis in a graph.

I have drawn a graph of NPV with a X-axis of time in years, which is 1 to 40. I have a input cell where I can set the Life expectancy of the project (e.g. 25).

Is it possible to have excel change the x-axis depending on the life expectancy of the project (so somewhere between 1 and 40, depending on the input)

I am working in excel 2003 (company hasn't upgraded yet) and I want to do this without VBA's or Macro's as this is the explicit wish of the company.
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
I think you can go about this by using names.
Altho I haven't worked with constant x-axis,
I managed to create automatic adjustment of x-axis and y-axis using ranges as names.

Will it be just one cell that represents the life expentancy or will it be a range?

For example,
will it be just 25 in cell A1? or 1 to 25 in cell A1:A25?
 
Upvote 0
Hi, Koejns.
I'm not too sure how to do it with a single cell so I'll just tell you how to do it with the range.

1) Select the x-axis range (A1:A40 even though A26:A40 may not be populated, you want the upperbound range), define it as a name. So, let's name it "x".

2) Select the y-axis range (B1:B40), define it as a name. So let's name it "y".

3) Create a graph

4) Right click on the graph

5) Select "Select Data"

6) Add Series

7) In x range, Type "='yourfilename.xls'!x" (without the double quotation) and in y range, type "='yourfilename.xls'!y" (without the double quotation)

8) Done!

Note: it is essential that your names are set to workbook level, NOT any other levels. and also make sure you type in the FULL name of your excel workbook with extensions inside the single quotation mark.

Hope it helps.
 
Upvote 0
I think it works even when you have multiple tabs as long as the name's scope is set to workbook.
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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