SOLVED

Use a cell to refer to a tab

%3CLINGO-SUB%20id%3D%22lingo-sub-3175900%22%20slang%3D%22en-US%22%3EUse%20a%20cell%20to%20refer%20to%20a%20tab%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3175900%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20adding%20cell%20H26%20of%20tabs%20named%201%2C2%20%26amp%3B%203%20using%20the%20following%20formula%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3DSUM('1%3A3'!H26)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EInstead%20of%20the%20number%203%20in%20the%20above%20formula%2C%20I%20would%20like%20to%20be%20able%20to%20reference%20a%20cell%20to%20give%20me%20the%20tab%20name.%20That%20way%20if%20I%20add%20tabs%20I%20can%20easily%20update%20all%20the%20formulas.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20%3CLI-EMOJI%20id%3D%22lia_slightly-smiling-face%22%20title%3D%22%3Aslightly_smiling_face%3A%22%3E%3C%2FLI-EMOJI%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3175900%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3176005%22%20slang%3D%22en-US%22%3ERe%3A%20Use%20a%20cell%20to%20refer%20to%20a%20tab%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3176005%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1309518%22%20target%3D%22_blank%22%3E%40Alicia_Racine%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOn%20another%20sheet%2C%20format%20a%20column%20as%20Text.%3C%2FP%3E%0A%3CP%3EEnter%20the%20names%20of%20the%20sheets%20(such%20as%201%202%20and%203)%20in%20cells%20in%20this%20column.%3C%2FP%3E%0A%3CP%3ESelect%20the%20names.%3C%2FP%3E%0A%3CP%3EClick%20in%20the%20Name%20box%20on%20the%20left%20hand%20side%20of%20the%20formula%20bar.%3C%2FP%3E%0A%3CP%3EEnter%20SheetName%20and%20press%20Enter.%20This%20assigns%20the%20name%20SheetName%20to%20the%20list%20of%20names.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFormat%20two%20other%20cells%2C%20e.g.%20C1%20and%20D1%20as%20Text%20too.%3C%2FP%3E%0A%3CP%3ESelect%20C1%20and%20name%20it%20First.%3C%2FP%3E%0A%3CP%3ESelect%20D1%20and%20name%20it%20Last.%3C%2FP%3E%0A%3CP%3EEnter%20the%20name%20of%20the%20first%20sheet%20to%20include%20in%20C1%2C%20and%20the%20name%20of%20the%20last%20sheet%20to%20include%20in%20D1.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20now%20use%20the%20formula%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3DSUM(INDIRECT(%22'%22%26amp%3BINDEX(SheetList%2CMATCH(First%2CSheetList%2C0))%3AINDEX(SheetList%2CMATCH(Last%2CSheetList%2C0))%26amp%3B%22'!H26%22))%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20don't%20have%20Microsoft%20365%20or%20Office%202021%20confirm%20the%20formula%20with%20Ctrl%2BShift%2BEnter.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20you%20change%20the%20values%20of%20the%20First%20and%20Last%20cell%2C%20you'll%20see%20the%20result%20of%20the%20formula%20change.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22S1149.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F348896iA7795CE88E36741A%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22S1149.png%22%20alt%3D%22S1149.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3176259%22%20slang%3D%22en-US%22%3ERe%3A%20Use%20a%20cell%20to%20refer%20to%20a%20tab%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3176259%22%20slang%3D%22en-US%22%3EThank%20you!%3C%2FLINGO-BODY%3E
New Contributor

Hello, 

 

I am adding cell H26 of tabs named 1,2 & 3 using the following formula:

 

=SUM('1:3'!H26)

 

Instead of the number 3 in the above formula, I would like to be able to reference a cell to give me the tab name. That way if I add tabs I can easily update all the formulas.

 

Thanks  

 

 

 

2 Replies
best response confirmed by Alicia_Racine (New Contributor)
Solution

@Alicia_Racine 

On another sheet, format a column as Text.

Enter the names of the sheets (such as 1 2 and 3) in cells in this column.

Select the names.

Click in the Name box on the left hand side of the formula bar.

Enter SheetName and press Enter. This assigns the name SheetName to the list of names.

 

Format two other cells, e.g. C1 and D1 as Text too.

Select C1 and name it First.

Select D1 and name it Last.

Enter the name of the first sheet to include in C1, and the name of the last sheet to include in D1.

 

You can now use the formula

 

=SUM(INDIRECT("'"&INDEX(SheetList,MATCH(First,SheetList,0)):INDEX(SheetList,MATCH(Last,SheetList,0))&"'!H26"))

 

If you don't have Microsoft 365 or Office 2021 confirm the formula with Ctrl+Shift+Enter.

 

As you change the values of the First and Last cell, you'll see the result of the formula change.

S1149.png

Thank you!