How to create dynamic named ranges in Google Sheets

I’d always believed that Named Ranges in Google Sheets would only accept static ranges and not formulas like Excel, which makes them less powerful of course. (Check out the Named ranges sidebar and you’ll see what I mean. No place to add formula-based dynamic ranges in there.)

However, there is a clever trick using the INDIRECT formula that DOES allow it!

Drumroll please…

Dynamic range in Google Sheets

Using formulas in named ranges to make them dynamic

Step 1: Create a formula whose output is a range reference in string format, for example:


where cell B1 contains an integer that we control (typed or from a calculation).

So if cell B1 contains the integer 500 say, the output of this formula would be a text string as follows:


Step 2: Create a named range for this cell with the string in.

Click on the formula cell, click on Data > Named ranges... and give it a name, e.g. dynamicRange

Step 3: Combine this named range with the INDIRECT formula to refer to this string range inside your other formulas, which gives you a dynamic named range.

For example, to create a dynamic sum we could do this:


Or a dynamic sparkline:


Once these are setup, if you go back and change the value in cell B1, the range will update and the formulas in Step 3 will also update.

Can I see an example worksheet?

Yes, here you go.

How does this formula work?

dynamic named range explanation

  1. Formula to count last row
  2. Formula to create a string range reference
  3. This cell is a named range: dynamicRange
  4. SUM formula using INDIRECT and the named range
  5. SPARKLINE formula using INDIRECT and the named range

Dynamic named ranges! Woohoo! This is one of my all time favorite Google Sheet tricks.

9 thoughts on “How to create dynamic named ranges in Google Sheets”

  1. I am trying to use method 1 in VLOOKUP, but its not working. I want to give range as sheet ‘1’ column A through R(‘1’!A:R). VLOOKUP gives out of bound range error when I replace the input with formula

    1. Hi Rachit,

      I tried this with a sheet labelled ‘1’ and my vlookup formula looked like this:


      It worked fine when I tried, so not sure what’s going wrong with your formula. Have you tried to return a column outside of the range A:R, by using an integer beyond 18 as your third argument in the vlookup? That would give an out of bounds for example.


  2. Is there a way to make the used columns dynamic as well, not just the rows? Considering that most likely I determine a column as a number, not a letter.

    1. Hey Johannes,

      For a column example, you’d replicate the steps but use a formula like this one to create the dynamic range:


      Then your next formula would be something like this:


      which gives you the same behaviour but for a column.

      I don’t see any reason why you wouldn’t be able to combine dynamic row and column references into a formula. Your final formula would look something like this:


      where all four row/columns references pull in from cells.

      Hope that helps!


  3. If you try to use the named range in another sheet in the same document, it doesn’t work. Is there any way around that? I thought named ranges crossed sheets.

    1. Hey Dave,

      Any named ranges are accessible anywhere in the Google Sheet in which they were created. You can also transfer named range data from one sheet to another using the IMPORTRANGE function like so:

      =importRange("Google Sheet URL","Named Range name")

      Unfortunately, you can’t transfer a reference to cells from one Sheet and use the indirect in a different Sheet with that reference, so this dynamic named range is concept is restricted to the Sheet in which it is conceived.


Leave a Reply

Your email address will not be published. Required fields are marked *