Dynamic ranges - blank rows

LUMPIA

New Member
Joined
May 5, 2011
Messages
6
Hello,

I am brand new to the board "officially". I have browsed many, many times and found such helpful information. There are some real experts on this forum.

I am stuck getting this formula to work properly. My apologies if this is already addressed somewhere....

I want to create Dynamic Ranges that expand and contract with changing source data that I drive a series of pivots from (expanding rows and columns).

There may be instances where there is a blank cell in the row and I need to ensure the range sees any data appearing after that. I have tried to substitute my COUNTA with MATCH, but I can get the syntax correct.

The formula below works, but stops at blanks.

=OFFSET(DataA!$A$1,0,0,COUNTA(DataA!$A:$A),COUNTA(DataA!$1:$1))

(DataA is what I name the worksheet and range)

Any suggestions?

Regards,
Liz
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Welcome to the board...

Is your data TEXT or NUMERIC ?

To get the last NUMERIC Row, use
MATCH(9.99999999999999E+307,DataA!$A:$A)


To get the last TEXT Row, use
MATCH(REPT("Z",255),DataA!$A:$A)


So replace each of the counta's in your formula as required.

Hope that helps.
 
Upvote 0
WOW! Thanks for the insanely quick response.

My data could be either text or numeric. My file contains about 15 different tabs representing each Range. I then have 40+ pivot tables referencing them. I'm hoping to have a formula that will cover all variables. I can then pop it into any of my files with confidence and little or no maintenance.

Is there a way to account for text or numeric blanks in the same formula?
 
Upvote 0
Define VSize as referring to:

If column A on DataA is numeric...

=MATCH(9.99999999999999E+307,DataA!$A:$A)-ROW(DataA!$A$2)+1

If column A on DataA consists of text-values...

=MATCH(REPT("z",255),DataA!$A:$A)-ROW(DataA!$A$2)+1

The foregoing definition does not include A1, part of the header row, but
if that is desired, simply adjust to suit.

Define HSize to refer to:

=MATCH(REPT("z",255),DataA!$1:$1)-COLUMN(DataA!$A$1)+1

We can now define Data (or DataA) as referring to:

=OFFSET(DataA!$A$2,0,0,VSize,HSize)

 
Upvote 0
Is there a way to account for text or numeric blanks in the same formula?

Use

=MATCH(2,1/($A$1:$A$65535<>""))

Note the row references,
In XL2003 and prior, you cannot use entire column refs in an array formula.
You can in XL2007 or higher, but not recommended.
 
Upvote 0
Hello, Try this;

=MAX(LOOKUP(1E+100,CHOOSE({1,2},1,MATCH(1E+100,$A:$A))),LOOKUP(1E+100,CHOOSE({1,2},1,MATCH(REPT("Z",250),$A:$A))))


Is there a way to account for text or numeric blanks in the same formula?
 
Upvote 0
Use

=MATCH(2,1/($A$1:$A$65535<>""))

Note the row references,
In XL2003 and prior, you cannot use entire column refs in an array formula.
You can in XL2007 or higher, but not recommended.

jonmo1, I am unable to get this working properly. This is what i tried:

=OFFSET(DataA!$A$1,0,0, MATCH(2,1/($A$:$A$<>""))MATCH(2,1/($A$1:$A$65535<>""))<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>

Also I am running XL2007 & XL2010 on different machines that I work on. Since the rows are greater than 65,535 from XL2003 - should I just increase the range? You recommended not referencing entire columns in XL2007, can you explain why? I also would prefer to stay away from arrays if possible.

Thanks for all your help
Liz
 
Upvote 0
Define VSize as referring to:

If column A on DataA is numeric...

=MATCH(9.99999999999999E+307,DataA!$A:$A)-ROW(DataA!$A$2)+1

If column A on DataA consists of text-values...

=MATCH(REPT("z",255),DataA!$A:$A)-ROW(DataA!$A$2)+1

The foregoing definition does not include A1, part of the header row, but
if that is desired, simply adjust to suit.

Define HSize to refer to:

=MATCH(REPT("z",255),DataA!$1:$1)-COLUMN(DataA!$A$1)+1

We can now define Data (or DataA) as referring to:

=OFFSET(DataA!$A$2,0,0,VSize,HSize)

Aladin,

Thank you for spending time to help me with this problem. I am trying to apply your formula, but not having much success. I am not as advanced as you- so please bear with me... When you say "Define Hsize" are you refering to me creating a UDF(User defined Funcition)? Can this handle text or numeric in the same formula?

Thank you,
Liz
 
Upvote 0
Try

=OFFSET(DataA!$A$1,0,0, MATCH(2,1/(DataA!$A:$A<>"")),MATCH(2,1/(DataA!$1:$1<>"")))<?xml:namespace prefix = o /><o:p></o:p>
 
Last edited:
Upvote 0
Aladin,

Thank you for spending time to help me with this problem. I am trying to apply your formula, but not having much success. I am not as advanced as you- so please bear with me... When you say "Define Hsize" are you refering to me creating a UDF(User defined Funcition)? Can this handle text or numeric in the same formula?

Thank you,
Liz

A name is defined by means of Insert | Name | Define (on all versions
prior to 2007) or by means of Formulas | Name Manager, so there is no need for VBA.
 
Upvote 0

Forum statistics

Threads
1,224,551
Messages
6,179,476
Members
452,915
Latest member
hannnahheileen

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