Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9117181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:50:47+00:00 2026-06-17T04:50:47+00:00

Whithin the same document (workbook), whenever I create named ranges, I have something like

  • 0

Whithin the same document (workbook), whenever I create named ranges, I have something like Sheet1!A1 but it is always refering to Sheet1. Is there any way in which I could refer to the current spreadsheet instead?

Something like this!A1 which will turn into Sheet1!A1 if I’m currently in Sheet1 or Sheet200!A1 if I’m in Sheet200.

The purpuse is to reuse the same formulas (with already have the named intervals) in all the spreadsheets of the workbook. I found it rather stupid this global and fixed reference. This way I always have to recreate my formulas for each spreadsheet.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T04:50:48+00:00Added an answer on June 17, 2026 at 4:50 am

    A named range refers to a specific range of cells on a specific sheet – I don’t see that changing anytime soon.

    But here is a custom function you can put into your spreadsheet’s script that will “localize” ranges for you. This code is also available for download in this Gist.

    /*
     * Return a string with the A1 notation for the given range, with
     * the sheet reference removed. To use in spreadsheet functions,
     * enclose with INDIRECT().
     *
     * Example: 
     *   =index(INDIRECT(localizeNamedRange(NamedRange1)),12,4)
     *
     * @param {string} rangeName  The name of an existing range in the
     *                        active spreadsheet. It does not matter which
     *                        sheet the range was defined for.
     *
     * @return {string}       The cell range from the provided rangeName,
     *                        in A1 notation.
     */
    function localizeNamedRange( rangeName ) {
      var sheet = SpreadsheetApp.getActiveSpreadsheet();
    
      // Get range by name
      var origRange = sheet.getRangeByName(rangeName);
    
      // Get notation for the range, without sheet reference.
      var notation = "";
      if (origRange !== null) {
        notation = origRange.getA1Notation();
      }
    
      // Return range in A1 notation
      debugger;   // pause to examine if running in debugger
      return ( notation );
    }
    

    Here’s an example. NamedRange1 has been defined as “Sheet1!A10:A22”. If we put =localizeNamedRange(NamedRange1) in a cell, it will return A10:A22, without the reference to Sheet1. That’s a string, so if we want to use it in a formula that expects a range, we need to convert it – and do that, we use the built-in function INDIRECT().

    On Sheet1 we have a formula in cell A3 that calculates the average value of NamedRange1. Here’s how to define that formula to make it localize-able:

    (A3) =AVERAGE(INDIRECT(localizeNamedRange(NamedRange1));
    

    If you now copy Sheet1 into a new Sheet2, you’ll find that the formula still works, and that it performs its calculations on the data on Sheet2, even though the Named Range refers to Sheet1.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a conflict regarding some jquery scripts within the same document header of
If I run something like so: var div1 = document.getElementById('div1'), div2 = document.getElementById('div2'); function
I have 2 classes within same package. Both classes have main method in them.
myfunc() runs successfully when called from within the same js file. but it is
We have ColdFusion and Active Directory running within the same domain. I'm trying to
How do I have a PowerShell script embedded within the same file as a
I used the FPDF class to create a multi-page PDF document and then I
I have below code: <ul> <li id=1>same html structure as below...</li> ..... <li id=42>
I have a document based application running with core data. The object model has
I have a page with an iframe that has an html document within it.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.