2

I have a question , similar to this VBA: Modify chart data range But I the answer was based on horizontal data set.

How can I make this named range update to include latest row on a vertical column set ?

This is what I got as my formula, B1 being the header, and Column B will have all my data.

=OFFSET(Sheet1!$B$1,,,1,COUNTA(Sheet1!$B2:$B))

Edit

I am using the following defined range now:

=OFFSET(Sheet1!$B$2,,,COUNTA(Sheet1!$B2:$B1000),1)

but when I add it to my chart I get the following error:

enter image description here

1 Answer 1

1

You're almost there - you basically need to swap height parameter with width: =OFFSET(Sheet1!$B$1,,,COUNTA(Sheet1!$B1:$B1000),1)

Here's a range that excludes header in B1: =OFFSET(Sheet1!$B$2,,,COUNTA(Sheet1!$B2:$B1000),1)

Of course you're welcome to extend the B1:B1000 range. Hope it helps!

Sign up to request clarification or add additional context in comments.

11 Comments

Thanks, for some reason I cannot add this named range to my chart. I am getting error . I'll add it to question.
I see. This must be happening because of lack of absolute references in Named Range formula. Once you start selecting other cells / playing around with the chart, the range will change (i.e. shift to your current selection) and thus it will stop working properly. Try adding absolute references to all cells: =OFFSET(Sheet1!$B$2,,,COUNTA(Sheet1!$B$2:$B$1000),1)
Could you let me know what is the result of your COUNTA formula? =COUNTA(Sheet1!$B$2:$B$1000) Another check might be to go to your Name Manager, select your Name and then select inside of the "Refers to" window - it should highlight the range which is represented by this formula.
Interesting, when I enter in the formula ,=COUNTA(Sheet1!$B$2:$B$1000) the open file dialog comes up. then I click cancel and its a value of 1.. btw my sheet name isnt actually Sheet1.
Thanks for checking - this might be the issue. Try updating the whole formula and replace Sheet1 with your sheet name, for example: =OFFSET('My Sheet'!$B$2,,,COUNTA('My Sheet'!$B$2:$B$1000),1) Then repeat the checks we just discussed (check the result of COUNTA formula and check the range that is selected in Name Manager > Refers To)
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.