Solved

Using Cell Reference as Worksheet Name

Posted on 2013-12-02
6
332 Views
Last Modified: 2013-12-02
I have a spreadsheet that I have created to track totals for various worksheets in a workbook. Each time I add a new worksheet to the workbook I have to set up a series of formulas on a summary page to pull information from the newly created worksheet. To do that I have to manually type my new worksheet name into the formula each time. What I want to know is there a way to use a cell reference to populate the worksheet name rather than typing it in each time.

Here is one of my formulas which is in cell B3 on my summary worksheet.

=INDEX('Sheet'!$B$11:$B$100001, COUNTA('Sheet1'!$B$11:$B$100001), 1)

However in A3 of that same sheet I have the worksheet name, Sheet1, entered. What I would like to do is use a cell reference that would translate through the formula as "Sheet1" but everything I have tried has returned a #Ref! error. For example:

=INDEX('"3"'!$B$11:$B$100001, COUNTA('"A3"'!$B$11:$B$100001), 1)

does not work. I have tried several different variations of this same thing but everything I try returns the exact same error message.

Is this doable or is it impossible?
0
Comment
Question by:gacto
6 Comments
 
LVL 23

Accepted Solution

by:
NBVC earned 500 total points
ID: 39690943
Try:

=INDEX(INDIRECT("'"&A3&"'!$B$11:$B$100001"), COUNTA(INDIRECT("'"&A3&"'!$B$11:$B$100001")), 1)
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 39690987
This formula will give the sheet name in a saved file.

=REPLACE(CELL("filename"),1,FIND("]",CELL("filename")),"")
0
 
LVL 32

Expert Comment

by:Rob Henson
ID: 39691102
Slight addition to ssaquibh's suggestion.

On each sheet use:

=REPLACE(CELL("filename",A1),1,FIND("]",CELL("filename",A1)),"")

That will then give the sheet name for that sheet whereas previously the formula would give the sheet name for the active sheet.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 32

Expert Comment

by:Rob Henson
ID: 39691120
I have also something similar previously with the MID function.

On your summary sheet, are the sheet names hard coded or formula driven. If hard coded and the sheet name of the source sheet changes, the INDEX formula above won't be able to find the sheet and will give an error.

You can use this in cell A3 where your current sheet name is:

=REPLACE(CELL("filename",Sheet1!$A$1),1,FIND("]",CELL("filename",Sheet1!$A$1)),"")

The reference to sheet1 will then change with a change in sheet name and the calculated result would be the new sheet name, a self fulfilling prophecy as Wizards would say!

Thanks
Rob H
0
 

Author Closing Comment

by:gacto
ID: 39691165
Thanks for the quick response nb_vc.
0
 

Author Comment

by:gacto
ID: 39691173
robhenson,

my sheet names are hard coded but you bring up an interesting point. I will post another question to determine how to implement your suggestion. I do not know how to write the formula to populate my cell references with the sheet names. Ultimately this workbook will have new worksheets added on a regular basis so your suggestion will be extremely helpful.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now