Graph with variable range data

Gusher

Board Regular
Joined
Aug 21, 2011
Messages
202
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

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
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,236
Messages
6,170,915
Members
452,366
Latest member
TePunaBloke

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