Sometimes depending on the scenario, you may need to use worksheet names in the formula, providing the sheet name manually is a tedious task. To assist you to get rid of this issue in this article, I’m going to explain to you how you can use the sheet name in the dynamic formula in Excel.
Workbooks to Practice
3 Ways to Use Sheet Name in Dynamic Formula in Excel
To explain the procedures of using sheet names in a dynamic formula in the most understandable manner, I’m going to use the following 4 datasets that contain information about several sales representatives and their respective sales. In the following figures, you can see the four different sheets- Quarter 1, Quarter 2, Quarter 3, and Quarter 4.
1. Applying INDIRECT, IF, OR Functions to Use Sheet Name in Dynamic Formula in Excel
To do dynamic worksheet references you can use the INDIRECT function.
This function tries to evaluate text as a worksheet reference. This function helps lock the specified cell in a formula. We also can use this function within a formula because it changes cell references without changing the formula.
To get the summary of the Sales Rep in different quarters of a year. I’m going to use the INDIRECT function here.
- First, I selected the C4 cell to keep the Quater1 sales of Ahmed.
- Then I used the formula where B5 is the sheet from which I will extract data.
- After that, I selected C4 from sheet Quater1 because I will pull its data here.
- Type the following formula in cell C4.
Here is the extracted data from Quater1 in a new sheet.
- Now drag the formula of the first cell for the rest of the cell.
The formula will be copied to those cells and data will be extracted.
In case any of your sheets has an empty value then you can use the IF, and OR functions to avoid the error. The OR function will check if either of the sheets or values is present or not. If the value doesn’t exist it will return 0.
- Type the following formula in cell D4.
- Let’s remove Victor’s Sales from Quater1 (quarter).
Now it is showing 0 instead of showing any error because the C5 cell is empty.
Let’s undo the sales value for Victor and extract data of 4 Sales Representatives using the Excel AutoFill feature.
2. Implementing VLOOKUP Formula with Variable Sheet Name in Excel
You can use the INDIRECT function within the VLOOKUP function to extract data from multiple sheets. Here you can extract particular data or all the data from other sheets.
I have adjusted the dataset to show your examples of looking up dynamic sheet names in the formula.
Now I will use the VLOOKUP function within the INDIRECT function.
- First, I selected the lookup value B4 as I want to extract Sales data of Ahmed.
- Then I used the INDIRECT function where I made the sheet name absolute row reference and gave the range of sheet data.
- Apply the following formula in cell C4.
After applying the formula, I got the extracted value for Ahmed is $16,800.
- Now, to copy the formula for the rest of the cells I dragged the formula.
All data are extracted from 4 sheets in the new sheet.
- How to Keep a Cell Fixed in Excel Formula (4 Easy Ways)
- Mixed Cell Reference in Excel (4 Examples)
- Cell Reference in Excel VBA (8 Examples)
- Difference Between Absolute and Relative Reference in Excel
- How to Use Reference of Worksheets in Excel (5 Examples)
3. Applying Dynamic Formula to Refer to Another Workbook
We also can dynamically refer to cells in another workbook. First, I made a sheet where four sales representatives’ total sales have been calculated for a year.
Now, I opened another workbook named Dynamic Formula 2.xlsx and made a sheet where I put the workbook name and sheet name. Also mentioned is that I will extract the Total Sales of Ahmed, Victor, Alexander, and Rose and make a column for Total Sales and Cell Numbers.
- Now, Apply the formula in the Total Sales using the INDIRECT function mentioning Workbook Name, Sheet Name, and Cell Number.
While referencing another workbook remember to keep open your referenced workbook. Or you can mention the referenced workbook in the formula. Then the formula will be like the following one.
=INDIRECT('[Dynamic Formula 1.xlsx]Total Sales'!D4,"")
However, I am using the first one.
After, applying the formula the extracted data is here for Ahmed as C8 contains Ahmed’s data.
- Now you can drag the formula downward to copy the formula for the rest of the Cell Number.
Here all the mentioned Cell Numbers’ data are extracted.
Read More: Reference Another Sheet in Excel (3 Methods)
For doing practice, we have added a Practice portion on each sheet on the right portion.
In this article, I explained the dynamic way of providing Excel sheet names in the formula. Here you will know how to use dynamic formula references for excel sheet names in formula dynamic. Hope you will find this article helpful. You are most welcome to give any kind of suggestions, feedback, or ideas. Feel free to comment down below.
- Different Types of Cell References in Excel (With Examples)
- How to Reference a Cell from a Different Worksheet in Excel
- Excel VBA Examples with Cell Reference by Row and Column Number
- How to Use Cell References in Excel Formula (All Possible Ways)
- Excel VBA: Cell Reference in Another Sheet (4 Methods)
- Creating and Copying Formula Using Relative References in Excel
- Relative and Absolute Cell Address in the Spreadsheet