# Dynamic Named Ranges

### | | Information Helpful? Why Not Donate.

Got any Excel Questions? Free Excel Help

Possibly one of Excels most underutilized aspects is its ability to create dynamic named ranges that will expand and contract according to the data in them. Below are 7 different types of these ranges.

Excel Add-ins Get a free Workbook Size Reducer when you buy any of the OzGrid Add-ins. Or save by buying the collection. These Add-ins are designed to increase your Excel productivity, eliminate errors and do what can only be done via VBA code. The OzGrid Excel Plus includes a "Dynamic Named Range" creator that can create all the different types.

Named Range Manager Excel Add-in that does dynamic named ranges and so much more!

Dynamic Named Ranges Examples

For ALL examples you need to:

• Fill Column A with a mix of text and numeric entries.
• Go to: Insert>Name>Define and in the Names in workbook box type any one word name (I will use MyRange) the only part that will change is the formula we place in the Refers to box.
• 1:Expand Down as Many Rows as There are Numeric Entries.
In the Refers to box type: =OFFSET(\$A\$1,0,0,COUNT(\$A:\$A),1)
• 2:Expand Down as Many Rows as There are Numeric and Text Entries.
In the Refers to box type: =OFFSET(\$A\$1,0,0,COUNTA(\$A:\$A),1)
• 3:Expand Down to The Last Numeric Entry
In the Refers to box type: =OFFSET(\$A\$1,0,0,MATCH(1E+306,\$A:\$A,1),1)
If you expect a number larger than 1E+306 (a one with 306 zeros) then change this to a larger number.
• 4:Expand Down to The Last Text Entry
In the Refers to box type: =OFFSET(\$A\$1,0,0,MATCH("*",\$A:\$A,-1),1)
• 5:Expand Down Based on Another Cell Value
Put the number 10 in cell B1 first then:
In the Refers to box type: =OFFSET(\$A\$1,0,0,\$B\$1,1)
Now change the number in cell B1 and the range will change accordingly.
• 6:Expand Down One Row Each Month
In the Refers to box type: =OFFSET(\$A\$1,0,0,MONTH(TODAY()),1)
• 7:Expand Down One Row Each Week
In the Refers to box type: =OFFSET(\$A\$1,0,0,WEEKNUM(TODAY()),1)
Requires the "Analysis Toolpak" to be installed. Tools>Add-ins-Analysis Toolpak

The good thing about number 3,4,5,6 and 7 is that they will include blank cells.

You can also change the Columns the dynamic range will span by simply changing the last Argument of the OFFSET function to a higher number than 1.

You could even expand across your Columns dynamically by placing another COUNT or COUNTA formula as the last argument, instead of 1. See below:

In the Refers to box type: =OFFSET(\$A\$1,0,0,COUNTA(\$A:\$A),COUNTA(\$1:\$1))

This dynamic range will now also expand across Columns in Row 1. So if you add another Column to your Table the dynamic range will automatically incorporate it.

To try and give you a better understanding of the OFFSET formula, read the text below taken from the Excel help file.

OFFSET(reference,rows, cols,height,width)

Reference : is the reference from which you want to base the offset. Reference must be a reference to a cell or range of adjacent cells; otherwise, OFFSET returns the #VALUE! error value.

Rows : is the number of rows, up or down, that you want the upper-left cell to refer to. Using 5 as the rows argument specifies that the upper-left cell in the reference is five rows below reference. Rows can be positive (which means below the Starting reference) or negative (which means above the Starting reference).

Cols : is the number of columns, to the left or right, that you want the upper-left cell of the result to refer to. Using 5 as the cols argument specifies that the upper-left cell in the reference is five columns to the right of reference. Cols can be positive (which means to the right of the Starting reference) or negative (which means to the left of the Starting reference).
If rows and cols offset reference over the edge of the worksheet, OFFSET returns the #REF! error value.

Height : is the height, in number of rows, that you want the returned reference to be. Height must be a positive number.

Width : is the width, in number of columns, that you want the returned reference to be. Width must be a positive number.
If height or width is omitted, it is assumed to be the same height or width as reference.