5 Ways to Insert Dynamic Sheet Name in Excel Formula

Sometimes we need to use data from different sheets. In this case for a small dataset, we do a hectic job like copying and pasting the data to a new workbook/sheet. But what we can do to get rid of these issues is, to use sheet name in the dynamic formula in Excel. In this article, learn to use sheet name in formula dynamic, we will discuss several methods to use sheet names in dynamic formulas.


📁 Download Excel File

To practice please download the excel file from here:


Learn to Insert Dynamic Sheet Name in Excel Formula with 5 Ways

We consider a dataset named Sales Data of Amigo Super Store. In the dataset, there is 5 heading containing Sales Person, Product, Sales Unit(May), Sales Unit(June), and Sales Unit(July). There are also 6 columns as well as 11 rows in the dataset. In this article, we are going to use INDIRECT, VLOOKUP, INDEX, and HYPERLINK functions.

Sample Dataset To use excel sheet name in formula in dynamic way

We also have 3 separate datasets for each month May, June, and July containing 4 columns and 11 rows.

Sheet Name May.

Method

1. Use Sheet Name in Dynamic Formula Using INDIRECT Function in Excel

Using the INDIRECT function you can insert data from any sheet of the same workbook. Please follow the below steps.

 ⬇️⬇️ STEPS ⬇️⬇️

  • First, select a blank cell i.e. C6.
  • Secondly, Insert the following formula in C6 containing the INDIRECT function.
=INDIRECT(B6&”!D6″)

🔨 Formula Breakdown

👉  Here, formula INDIRECT(B6&”!D6″)= INDIRECT(“May”&”!D6″) ; where B6= May.

👉  “May”&”!D6″= “May!D6″: Here, two strings are combined using the Ampersand operator.

👉  Finally, INDIRECT(“May!D6″) means the value that is located at D6= 15600.

  • Therefore, we get the value at D6.

Use of INDIRECT function to insert sheet data.

  • Auto-filling we finally get the total output for Jenny, Mike, and Ammy.

Use of INDIRECT function to insert sheet data in a dynamic formula.

Method

2. Implementing VLOOKUP Function with Variable Sheet Name in Excel

Using the VLOOKUP function to look up the values in another sheet can be another way to link and get values. Please follow the necessary procedure.

 ⬇️⬇️ STEPS ⬇️⬇️

  • Initially navigate a blank cell i.e. C6.
  • Secondly, Insert the following formula in C6 containing the INDIRECT and VLOOKUP functions.
=VLOOKUP($B6,INDIRECT($C$5&”!B6:D11″),3,0)

🔨 Formula Breakdown

👉  Firstly, $C$5&”!B6:D11″= “May”&”!B6:D11″ ; here May located in $C$5 with a return value.

👉  Secondly, INDIRECT(“May”&”!B6:D11″)= INDIRECT(“May!B6:D11″) ; Again two strings May and !B6:D11 are combined using the Ampersand operator.

👉  Thirdly, VLOOKUP(“Jenny”,INDIRECT(“May!B6:D11″),3,0)= VLOOKUP(“Jenny”,May$B$6:$D$11,3,0) which means Find Jenny’s data from 3rd column in range $B$6:$D$11 of sheet May and the value is 15600.

  • Finally, we obtain the sales data for Jenny in May from sheet May.

Use of VLOOKUP function to insert sheet data.

  • Using Fill Handle or Auto-filling the table, we similarly obtain all the data in a separate sheet.

Use of VLOOKUP function to insert sheet data in a dynamic formula.

Method

3. Get Reference Sheet Name by INDEX in Excel

With an index column, and calling sheet names using INDEX and HYPERLINK functions, you can easily jump any worksheet in a workbook very easily. Please check out the steps below.

 ⬇️⬇️ STEPS ⬇️⬇️

  • Initially make an Index.
  • Then from Formulas Menu, select Define Name.

Making index to refer sheet name.

  • A box named New Name appears.
  • Type the Name and insert the following formula in Refers to.
=REPLACE(GET.WORKBOOK(1),1,FIND(“]”,GET.WORKBOOK(1)),””)
  • Then click on the OK button.

Formula to make an index.

  • Now write the index number in ascending order (1,2,3) under the Index column.

Making Index to call sheet name.

  • Next, insert the following formula in C6.
=INDEX(Sheet_Name,B6)
  • The INDEX function finds the sheet name using B6 accordingly and the sheet name is Dataset.

INDEX function to call Sheet names with a dynamic formula.

  • Finally, using Fill Handle, we obtain sheet names in the Sheet Name column.

HYPERLINK function to jump another sheet.

  • Again in D6, insert the following formula containing HYPERLINK to jump into the sheet.
=HYPERLINK(“#'”&C6&”‘!B3″,”Go To Sheet”)

🔨 Formula Breakdown

👉  (“#'”&C6&”‘!B3″,”Go To Sheet”)= (“#'”&”Dataset”&”‘!B3″,”Go To Sheet”); Here, C6 is Dataset which is the name of the first sheet of this workbook. 

👉  (“#'”&”Dataset”&”‘!B3″,”Go To Sheet”)= (“Dataset”&”‘!B3″,”Go To Sheet”); Now, # and Dataset are the two strings that are combined with Ampersand operator.

👉  (“Dataset”&”‘!B3″,”Go To Sheet”)= (“Dataset!B3″,”Go To Sheet”); Again, Dataset and !B3 are the two strings that are also combined with Ampersand operator.

👉  HYPERLINK(“Dataset!B3″,”Go To Sheet”)= “Go To Sheet” with hyperlink.

👉  Therefore, by clicking“Go To Sheet”, you will be able to navigate sheets directly.

HYPERLINK function in a dynamic formula to jump another sheet associated with sheet names.

  • Now, by clicking on Go To Sheet, we can go to the sheet Dataset.
  • Auto-filling the column, we get the desired output containing hyperlinks.
  • Finally, we can jump to any sheet by clicking on the cell.

HYPERLINK function to jump to another sheet by clicking cells.

Method

4. Get Sheet Name from Cell Value Using VBA in Excel

We can use the VBA code to get the sheet name from a cell value. With the help of the Developer option, you can generate a program of your own. Please follow the steps.

⬇️⬇️ STEPS ⬇️⬇️

  • First, Check if your Developer option is available or not.
  • Then to enable the Developer option, right-click on the mouse at the top Ribbon and select Customize the Ribbon.

Enabling VBA macro.

  • Click on Developer and click on OK.

Getting Developer option.

  • Now Developer mode is on.
  • Click on the Visual Basic option.
  • To insert the VBA code, click on Module from the Insert option.

Use of VBA Macro.

  • Insert the following code in the Module and click Run to execute the VBA Macro.

Code:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Set Target = Range("C5")
If Target = "" Then Exit Sub
Application.ActiveSheet.Name = VBA.Left(Target, 31)
Exit Sub
End Sub

VBA code to get the sheet name from a cell.

  • Therefore, we get the Sheet name Jenny from cell C5.

VBA to name a sheet from a cell.

Method

5. Applying Dynamic Formula to Refer to Another Workbook

Suppose you need to prepare a workbook only to count total sales from another workbook. What to do? Let’s follow the procedure to get data from another workbook.

⬇️⬇️ STEPS ⬇️⬇️

  • First, Open the workbook from where you want to import data.
  • Secondly, Inspect the File name and Sheet name very carefully.
  • Then, select a cell i.e. F6, and insert the following formula.
='[Sheet Name in Formula Dynamic 1.xlsm]Total sales’!$C$9
  • Formula ='[Sheet Name in Formula Dynamic 1.xlsm]Total sales’!$C$9 denotes to open sheet Total sales from Excel file Sheet Name in Formula Dynamic 1.xlsm and take value from $C$9.

Use another worksheet to get values.

  • Therefore, in the new workbook, we get our output from another workbook named Sheet Name in Formula Dynamic-1.

Use of a sheet from another workbook in a dynamic formula.


📄 Important Notes

🖊️  Be careful and measure accurately during working with different sheets and workbooks. Otherwise, you will lose your data.

🖊️  Don’t close workbooks while working with multiple workbooks and sheets.

🖊️  During working with VBA code, check whether your Developer tool is available.


📝 Takeaway from This Article

📌  INDEX function to get Sheet Names from the same workbook.

📌  VLOOKUP and INDIRECT functions to get the data from different sheets.

📌  HYPERLINK function to jump to a particular sheet.

📌  Linking Workbooks to one another to make them dynamic.

📌  VBA to make sheet name from cell value.


Conclusion

We demonstrated every possible use of sheet names in the dynamic formulas in Excel. I hope you enjoyed your learning. Any suggestions as well as queries appreciated. For better understanding and new knowledge don’t forget to visit www.ExcelDen.com.


Related Articles

(Visited 43 times, 1 visits today)
MD Tanvir Rahman

MD Tanvir Rahman

Hello, I am Tanvir. Graduated from BUET. Had a year-long Experience at Operation of Vitacan Industries Ltd. I found Excel is the most unique software to reduce both time and paper. Now, I am an Excel enthusiast, love to play with data and publish content.

We will be happy to hear your thoughts

Leave a reply

ExcelDen
Logo