Using Offset and CountA to create a dynamic range in a chart

Peter Davison

Active Member
Joined
Jun 4, 2020
Messages
433
Office Version
  1. 365
Platform
  1. Windows
Hi,
I'm trying to set a dynamic range in a chart
My header is in cell E16 and my data can be in cells E17 to E517 or more
For this example my data is only 200 cells created from formulas in the cells so I have 300 blank cells with formulas in.
I don't know how to make the dynamic range ignore the formula blank cells?
Any help would be appreciated.
Thanks

=OFFSET('Start Data1'!$E$16,0,0,COUNTA('Start Data1'!$E$17:$E$517)-1,1)
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Hi
I just wondered if anyone was able to help me on the query above.
Thanks, any help would be great.
 
Upvote 0
I guess you use suc formula to create a NamedRange and then use named ranges to define the Chart source data.

Try using the following formula:
VBA Code:
=OFFSET('Start Data'!$E$1,0,0,SUM(--(LEN('Start Data'!$E$1:$E$500)>0)),1)

Bye
 
Upvote 0
Thank you I will give it a go shortly.
Regards your help is greatly appreciated.
 
Upvote 0
Hi,
Sorry me again
I tried the code below (had to put row 17 in as the start row because I have other data in rows 1 to 16)
Unfortunately it didn't work and returned all the blank cells that have formulas in.
Do you have any other thoughts?

As you said I am using it as a named range in the chart.

=OFFSET('Start Data1'!$E$17,0,0,SUM(--(LEN('Start Data1'!$E$17:$E$500)>0)),1)
 
Upvote 0
Sorry I think it has worked I had to enter the named range again.
I'll do a few more to double check.
Thanks for all your help so far.
I'm a bit of a beginner
 
Upvote 0
So I seem that eventually it worked (for now!); good
 
Upvote 0
Yes and thank you for your help, you have been most helpful.
I do have another question, if I can communicate it to you.

I have a row of data cells E16 to AW16 in sheet1 and another row of data in sheet 2 same cells E16 to AW16. They are all formula cells that populate data in a variable way.
So for example in sheet 1 I may have data in E16 to H16 and blan for the rest (all cells are formularised
and data in sheet 2 in E16 to H16 and blank for the rest.
I am creating a stack chart in 2 columns (Column 1 is sheet1 and column 2 is sheet2). This is in a separate Chart File called "Graph"
Each of the entries in sheet 2 are used against each entry in sheet 1, so the data looks like the attached image (Chart Data jpg and the chart result is Chart jpg).

What I would like to do is have a formula or vba macro that goes and selects the data from sheet 1 and sheet 2 and places it in column D in the "Graph File" without leaving any gaps in rows.
I can then place formulas in the cells to get the chart numbers?
Would you have any thoughts on how best I can achieve this?
Any help would be great.
 
Upvote 0
Sorry forgot the attachments
 

Attachments

  • Chart Data.JPG
    Chart Data.JPG
    215.5 KB · Views: 5
  • Chart.JPG
    Chart.JPG
    100.9 KB · Views: 6
Upvote 0
Sorry, I didn't understand neither how the source data are organized nor how the destination table should be arranged and which are the rule behind
Try to share a sample worksbook, maybe it woud help, and anyway will be a test bed for any possible proposal.

Bye
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,483
Members
448,967
Latest member
visheshkotha

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