dynamic chart data

RobbieC

Active Member
Joined
Dec 14, 2016
Messages
376
Office Version
  1. 2010
Platform
  1. Windows
Hi there, I have 2 columns of data that are used in my chart. They are on Sheet 'Calcs' and are columns K6:K60 & M6:M60.

The 'Chart data range' is =Calcs!$K$6:$K$60,Calcs!$M$60:$M$60

This is fine if I have the both columns to row 60, but most of the time is less.

I have worked out the length of the column K & M in a seperate cell named 'chtLen' in cell V1 using: =SUMPRODUCT(MAX((K6:K60<>"")*ROW(K6:K60)))

This returns the number of entries in the column, for example '49'

So, I'm now hoping that I can replace the 'Chart data range' with something like:

="Calcs!$K$6:$K$" & chtLen, "Calcs!$M$6:$M$" & chtLen

If you can point me in the right direction to get this working, I'd be very grateful

Many thanks

Rob
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Make from your table an Excel Table (Format as Table).
Make the graph based on the Excel Table.
When you update the table the graph shall update automatically.
 
Upvote 0
When you wil refer to a range name you have to use INDIRECT.
But you can't use INDIRECT in a graph.
So you have to create a range name for the total array.
example:
array1=INDIRECT("'Calcs'!$K$6:$K$"&chtLen)
array2=INDIRECT("'Calcs'!$M$6:$M$"&chtLen)
Now you can use this names in a graph.
But you need also to refer to the workbookname.
example: 'workbookname.xlsx'!Array1
 
Upvote 0
Hi Mart, thanks for this. I've had a think...

This Workbook is designed as a template to be saved as 'whatever', so having the graph refer to the workbook name will be problematic. I was just trying to automate this so that people didn't have to fiddle with 'chart data' after inputting the data

The only way 'round it at the moment is to manually change the 'Chart Data Range' to the final row number in the column(s). Otherwise, the graph goes squiffy.

I shall have to go back to the drawing board

Thanks again Mart
 
Upvote 0

Forum statistics

Threads
1,214,849
Messages
6,121,925
Members
449,056
Latest member
denissimo

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