Forum Discussion

rorycampbell11's avatar
rorycampbell11
Copper Contributor
Feb 13, 2024

Cell reference autofilling

Hi there,

I have a spreadsheet with 52 tabs detailing various statistics. 

I would like to have a single tab at the end that gives a summary of the entire spreadsheet.

The tabs are named Week 1 , Week 2, Week 3 etc. In the summary tab the reference for Week 1 is set to "='Week 1'!B3". However when I go to Autofill the remaining 51 rows it will enter "='Week 1'!B4" then ='Week 1'!B4. 

Is it possible to set it up so that it will keep the cell reference the same but step the Week number/Tab number up one each time? ie. "='Week 1'!B3" then "='Week 2'!B3" then "='Week 3'!B3"

 

Many thanks,
Rory

2 Replies

  • rorycampbell11 

    Absolutely! There are two ways you can achieve the desired autofill behavior in your Excel spreadsheet:

    1. Using Relative Cell References:

    • The key lies in understanding relative and absolute cell references. By default, Excel uses relative references, meaning it changes the reference based on its position. In your case, you want to keep the cell number ("B3") constant but change the tab name.
    • Modify your initial formula: Instead of starting with "='Week 1'!B3", enter "='[Week 1]'!B3". Notice the square brackets around "Week 1". This instructs Excel to treat "Week 1" as a text string, not a cell reference.
    • Autofill: Now, when you drag the fill handle down, Excel will increment the number within the square brackets, resulting in formulas like "='[Week 2]'!B3", "='[Week 3]'!B3", and so on.

    2. Using the INDIRECT Function:

    • This method involves the INDIRECT function, which converts a text string into a cell reference.
    • Enter the following formula in your first cell: =INDIRECT("'" & A1 & "'!B3")
    • Replace "A1" with the cell containing the week number/tab name (e.g., "Week 1").
    • Autofill: Drag the fill handle down. The INDIRECT function will automatically adjust the week number in the text string based on the values in column A.

    Bonus Tip: If your tab names follow a consistent pattern (e.g., "Week" followed by a number), you can use the ROW() function in combination with the CELL("address") function to automatically generate the tab names in column A.

    Here are some additional details:

    • Using relative references is generally preferred when dealing with consistent patterns.
    • The INDIRECT function offers more flexibility but can be slower for large datasets.
    • Both methods achieve the desired autofill behavior with different approaches.

    Choose the method that best suits your needs and spreadsheet structure.

    • Riny_van_Eekelen's avatar
      Riny_van_Eekelen
      Platinum Contributor

      smylbugti222gmailcom Kindly remove the first suggestion of your AI generated answer. The square bracket notation is certainly not referring to any existing Excel feature.

       

Resources