Dynamic range: Has something changed in Excel 2007?

bydesign

Board Regular
Joined
Nov 29, 2003
Messages
184
All

In Excel 97 & 2003, I have been using dynamic ranges to count the total number of cells with data in a column using =OFFSET(SF!$G$2,0,0,COUNTA(SF!$G:$G)-1). This has always worked well.

In Excel 2007, using the same formula; I am getting a return of the value in G9... not the total number of cells with data in column G.

Column G has a title row and 137 contiguous cells with data.

When I edit the formula by opening the "Function Arguments" window (e.g. click "fx") the proper value of 136 is displayed next to the "height" argument.

Any ideas?
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
All

In Excel 97 & 2003, I have been using dynamic ranges to count the total number of cells with data in a column using =OFFSET(SF!$G$2,0,0,COUNTA(SF!$G:$G)-1). This has always worked well.

In Excel 2007, using the same formula; I am getting a return of the value in G9... not the total number of cells with data in column G.

Column G has a title row and 137 contiguous cells with data.

When I edit the formula by opening the "Function Arguments" window (e.g. click "fx") the proper value of 136 is displayed next to the "height" argument.


Any ideas?

I think, ms in both the versions work the same
You may have smt wrong

try to:
PHP:
=SUM(OFFSET(SF!$G$2,0,0,COUNTA(SF!$G:$G)-1))
 
Upvote 0
I think TigerTiger is correct. What you see for "height" is a part of your formula but not the final result:
COUNTA(SF!$G:$G)-1 '//Count of Cells in Column G - 1
 
Upvote 0
You formula will return a dynamic range, but you need to do something with it (e.g. SUM, MAX etc.). Simply refering to it will not result in any agregate result.

Try placing the formula in a named range:

Insert > Name > Define (not sure how this translates in xl2007):
Refers to: MyRange
Formula: =OFFSET(SF!$G$2,0,0,COUNTA(SF!$G:$G)-1)

Now click back on the name MyRange, then click into the formula - it should place an outline around the array that it returns.

An alternative to the OFFSET method could be (and an alternative that I prefer):

=SF!$G$2:INDEX(SF!$G:$G,MATCH(9.99999999999999E+307,SF!$G:$G))
--- assume that column G houses numbers

=SF!$G$2:INDEX(SF!$G:$G,MATCH(REPT("z",255),SF!$G:$G))
--- assume that column G houses text

OFFSET() is a volatile worksheet function and better avoided where there is an alternative method available.
 
Last edited:
Upvote 0
Thanks Jon - I did not realize Offset was volatile - and its a favorite {sigh}.

The question I've been longing to ask: how do you remember how many nines to type in ... :)
 
Upvote 0
Upvote 0
Thanks Jon - I did not realize Offset was volatile - and its a favorite {sigh}.

The question I've been longing to ask: how do you remember how many nines to type in ... :)

Aaah I don't have to! I have it named as BigNum in my default workbook Book.XLT. ;) That way it's readily available whenever I need it.

What are you trying to use the dynamic range for? Again I think the formula is ok, perhaps the problem lies in the application of it.
 
Last edited:
Upvote 0
Thanks Jon! I'm going to add this to my book.xlt too.

I'm a bit fuzzy in this thread but looking at the ozgrid page and the posts again, its sounds like we are talking about a formula entered as a defined name, not a function. Probably you need to go to Name Manager per Jon's suggestion and enter it there (giving it a name "DataRange") but it shouldn't be returning a value (?) - in essence it's a range of cells, not a count or a sum. That's why you can enter it as a chart series reference - or count/sum as you like -- =Count(DataRange) --
 
Upvote 0

Forum statistics

Threads
1,214,875
Messages
6,122,039
Members
449,063
Latest member
ak94

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