Formula to reference a tab

Mexcel73

New Member
Joined
Jun 20, 2024
Messages
14
Office Version
  1. 365
Platform
  1. Windows
Hello,

Is there a formula I can enter to reference a tab rather than having to change it manually? See file as an example.


Referencing Tab Formula Mr Excel.xlsx
ABCDEFG
1Weekly Box Office Sales
2
3The below is changed manually each week to refer to the new tab
4
510/27/202411/3/202411/10/202411/17/202411/24/202412/1/2024
6
7Gross Sales3,5004,2003,1503,5004,9004,550
8Net Sales3,3253,9902,9933,3254,6554,323
9
10
11I would like to have formulas in B16 to G17 to refer to the tab using row 13
12
1310.27.2411.03.2411.10.2411.17.2411.24.2412.01.24
1410/27/202411/3/202411/10/202411/17/202411/24/202412/1/2024
15
16Gross Sales
17Net Sales
Summary
Cell Formulas
RangeFormula
C5:G5,C14:G14C5=B5+7
B7:B8B7='10.27.24'!I6
C7:C8C7='11.03.24'!I6
D7:D8D7='11.10.24'!I6
E7:E8E7='11.17.24'!I6
F7:F8F7='11.24.24'!I6
G7:G8G7='12.01.24'!I6



Thank you in advance.

Michael
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Adding image of the sheet setup:

1732631911613.png
 
Upvote 0
I think this would work for you:
Excel Formula:
=INDIRECT("'"&B13&"'!"&I6)
B13 is the tab name, I6 is the info on that tab you want shown.
 
Upvote 0
Excel Formula:
=INDIRECT("'"&B13&"'!"&"I6")
Forgot the brackets on I6 :oops:
 
Upvote 0
Thank you so much! I didn't realize it would be a lot more difficult to do the same if the formula was referencing a different workbook saved in a different folder. Can you help with this as well?
And will the formula show up when the workbook it is referencing is closed? Or does it have to be open to show the results?
 
Upvote 0
Might be easier to make a macro in that case:
VBA Code:
Sub OpenAndCopyFromFile()
    Dim filePath As String
    Dim fileName As String
    Dim wb1 As Workbook
    Dim wb2 As Workbook
    
    Set wb1 = ThisWorkbook
    'get the file path and name from cells - replace with where you place the path
    filePath = wb1.Worksheets("Summary").Range("I1").Value
    fileName = wb1.Worksheets("Summary").Range("I2").Value
    
    'open the source workbook    
    Set wb2 = Workbooks.Open(filePath & "\" & fileName)
    'Copy values from the source sheet and range - replace with your sheetname and range
    wb2.Worksheets("Source sheet").Range("A3:I6").Copy
    wb1.Worksheets("Summary").Range("B16").PasteSpecial Paste:=xlPasteValuesAndNumberFormats
    
    'close the source workbook without saving
    wb2.Close False
End Sub
 
Upvote 0

Forum statistics

Threads
1,226,112
Messages
6,189,039
Members
453,521
Latest member
Chris_Hed

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top