Graph with variable range data

Gusher

Board Regular
Joined
Aug 21, 2011
Messages
207
Office Version
  1. 365
Platform
  1. Windows
In a sheet called CashP in starting in cell A1 in col A I have dates.

In col B I have numbers. I have created a line graph, dates on X axis and numbers on Y.

The number of dates available varies and I want the graph to be dynamic with the number of dates.

Accordingly I have created a range called "Dates" and the range is defined by the formula =OFFSET(CashP!$A$1,0,0,COUNT(CashP!$A:$A),1).

When I go to the range "Dates" I can see the range works dynamically.

The problem I have I cannot get the the range "Dates" into the graph. I have tries "selecte Data", then double clicked on X axis and clicked edit, but excel will not allow me to enter =dates as a range name.

Your thoughts please?

Mark
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
To start with I would not use Date or Dates in any code or formula. Been a while since I've done this but here's a series reference based on a dynamic named range:
=SERIES(" Budgeted Contracting FTE's (Financial)",OSCRchart.xlsx!DateRange,DATA!FTErange,2)

DateRange is the named range. Its scope is Workbook, not sheet. Perhaps that is your issue - IIRC, other sheets can't see ranges whose scope is some other sheet.
 
Upvote 0
@Micron is partly correct.

It's okay to use a Name like "Dates". More important is to avoid Names beginning with C or R (or the initial letter of your language's words for column and row).

The easiest way to put Names into the chart is to edit the SERIES formulas.

Make the chart with static ranges. The SERIES formula looks something like this:

=SERIES("some name",CashP!$A$1:$A$10,CashP!$B$1:$B$10,1)

Replace $A$1:$A$10 and $B$1:$B$10 with the names for your X and Y values, but (important!) retain the leading ChasP! in the references:

=SERIES("some name",CashP!Dates,CashP!Values,1)

If your Name is scoped locally, the worksheet name will remain. Otherwise Excel will change it to the Worksheet Name:

=SERIES("some name",'My Workbook.xlsx'!Dates,'My Workbook.xlsx'!Values,1)

Also, even if a Name is scoped to one worksheet, if the Name is prefixed by its worksheet's name, then formulas and charts in another worksheet can use the Name.
 
Upvote 0
Solution
@Micron is partly correct.

It's okay to use a Name like "Dates". More important is to avoid Names beginning with C or R (or the initial letter of your language's words for column and row).

The easiest way to put Names into the chart is to edit the SERIES formulas.

Make the chart with static ranges. The SERIES formula looks something like this:

=SERIES("some name",CashP!$A$1:$A$10,CashP!$B$1:$B$10,1)

Replace $A$1:$A$10 and $B$1:$B$10 with the names for your X and Y values, but (important!) retain the leading ChasP! in the references:

=SERIES("some name",CashP!Dates,CashP!Values,1)

If your Name is scoped locally, the worksheet name will remain. Otherwise Excel will change it to the Worksheet Name:

=SERIES("some name",'My Workbook.xlsx'!Dates,'My Workbook.xlsx'!Values,1)

Also, even if a Name is scoped to one worksheet, if the Name is prefixed by its worksheet's name, then formulas and charts in another worksheet can use the Name.
To start with I would not use Date or Dates in any code or formula. Been a while since I've done this but here's a series reference based on a dynamic named range:
=SERIES(" Budgeted Contracting FTE's (Financial)",OSCRchart.xlsx!DateRange,DATA!FTErange,2)

DateRange is the named range. Its scope is Workbook, not sheet. Perhaps that is your issue - IIRC, other sheets can't see ranges whose scope is some other sheet.
Many thanks for your help
 
Upvote 0
@Micron is partly correct.

It's okay to use a Name like "Dates". More important is to avoid Names beginning with C or R (or the initial letter of your language's words for column and row).

The easiest way to put Names into the chart is to edit the SERIES formulas.

Make the chart with static ranges. The SERIES formula looks something like this:

=SERIES("some name",CashP!$A$1:$A$10,CashP!$B$1:$B$10,1)

Replace $A$1:$A$10 and $B$1:$B$10 with the names for your X and Y values, but (important!) retain the leading ChasP! in the references:

=SERIES("some name",CashP!Dates,CashP!Values,1)

If your Name is scoped locally, the worksheet name will remain. Otherwise Excel will change it to the Worksheet Name:

=SERIES("some name",'My Workbook.xlsx'!Dates,'My Workbook.xlsx'!Values,1)

Also, even if a Name is scoped to one worksheet, if the Name is prefixed by its worksheet's name, then formulas and charts in another worksheet can use the Name.
Thanks Jon. That all works now
 
Upvote 0

Forum statistics

Threads
1,223,898
Messages
6,175,274
Members
452,628
Latest member
dd2

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