is there any way I can use Sheets INDEX instead of NAME to address it?
For example I have
Sheet1 (Calculations)
How can I address this sheet instead of using:
='Calculations'!CELL
I need it as sheets names will be changing according to their values
This link provides a way to do it with a user-defined function in VBA:
referencing sheets by number instead of name in cells
However, you may also want to consider a method that does not change the sheet names. As #DirkReichel implies, you can change sheet indices without changing sheet names and vice versa.
You might try using summary information stored on the sheet in question or keeping a summary sheet that references each sheet.
Related
I have a workbook with 12 sheets that have raw data (IP address Subnets) on them. I have each of these sheets using a named range so I can reference the data later easily. There are actually several named ranges per sheet, I'm focusing on just one for the purpose of the question.
Then I have my Info sheet that has different tables listing information about all of the raw data sheets.
One of the tables is referring to each of the named ranges. Right now I have the named range typed in, but I'm going to be adding more raw data sheets and want to refer to the named ranges dynamically.
The way it is setup now:
The raw data sheets are named based on the IP Subnet information held on the sheet. The named range is named for the sheet.
For example: Sheet Name: "Data_10.1" = Named Range Name "NewIP_10.1": Data10.1!K1:K400
On my Info sheet I have a table that is telling me how many new IPs were found today, it looks like this:
IP Range
New IPs
10.1
=COUNTIF(NewIP_10.1,"Add") = 10
10.10
=COUNTIF(NewIP_10.10,"Add") = 3
I would like to change that formula to be dynamic so that it looks something like:
=COUNTIF(CONCAT("NewIP_",A2),"Add")
This however did not work.
Is there a way to call a named range dynamically?
Use INDIRECT:
=COUNTIF(INDIRECT("NewIP_" & A2),"Add")
Note that INDIRECT is volatile and recalculates every time Excel recalculates. It should be used sparingly or avoided if possible.
I am working with CELL("address") function within INDIRECT to allow multiple cells as a searchable drop downlinst, and all is working fine, Problem is, CELL("address") function use whole Workbook cells, (where ever I type no matter which Sheet I am working.
I want to use specific sheet cell address, so when ever I work on other sheets this list should not update every time. Plz help
I have one excel file in which I have multiple sheets with financial statements from different companies (called Databas.xlsx). The structures of these sheets are identical. Then I have another excel file that I wish to use to analyse these financial statements using charts. Thus, I must get data from the different sheets into my analysis file. Doing this from one sheet is no problem, as I can simply create a chart and mark the data I need from this sheet, so that the chart data range would be something like this:
=[Databas.xlsx]Kopparbergs!$C$3:$K$3
where "Kopparbergs" is the sheet name in Databas.xlsx. The problem I am facing is that I want to be able to change the sheet name that is put into this formula by writing the name in a cell (because that would enable me to change multiple charts at once). So just to clarify, in the formula written above, I want to be able to change the word "Kopparbergs" by writing text in a cell. If that is not possible, how would I accomplish this? That is, how do you create a chart that can change its content depending on a text in a cell that corresponds to a sheet?
So rather than using Indirect I think you need to use two named ranges for referencing when using a Chart.
This previous answer looks like a good guide to implement (not sure about etiquette of just copy & pasting previous answers so I'll just provide the link):
Dynamic chart range using INDIRECT: That function is not valid (despite range highlighted)
I have vlookups to pull specific data from a workbook and paste into a new workbook in the desired layout. The layout of the first workbook never changes however the name will change when i want to run this on a different file.
My current formula is =VLOOKUP(A3,[Workbook1.xlsx]Sheet1!$B$3:$XFD$7,2,FALSE)
I would really like it to reference A1 instead of Workbook1 so I could then just update the file name in A1 every time I want to analyse a different file. I should mention the Sheet name won't ever change.
I know you have to use INDIRECT but im unsure how it works. I did try =VLOOKUP(A3,INDIRECT(A1),$B$3:$XFD$7,2,FALSE) but then i'd too many arguments and when i removed the $B$3:$XFD$7 i lost the range i was searching in.
Thanks!
With INDIRECT you must create the whole string that denotes the range reference:
=VLOOKUP(A3,INDIRECT("'[" & A1 & "]Sheet1'!$B$3:$XFD$7"),2,FALSE)
One more note, that INDIRECT requires that the workbook be open to function, or will return an error.
I have an Excel workbook with various tabs on it.
In Sheet 1 (named: ‘Pricing Calculator’) you can input various data and it calculates a price.
Sheet 2 (named: ‘Final Copy’) is basically the same as Sheet 1, however it is not used for inputting data. So in this sheet cell A1=’Pricing Calculator’!A1 etc. for most of the sheet.
However, sometimes Sheet 1 (‘Pricing Calculator’) is copied and that and the copied sheets renamed to ‘Option 1’, ‘Option 2’, ‘Option 3’ etc. Sheet 2 (‘Final Copy’) only needs to use information out of one of these sheets, but which one will depend on which option is chosen.
I have tried adding a cell into Sheet 2 (say it was A30) where you can type in exactly the name of the sheet to get the data from, and changing the cells to =’A30’!A1 etc, but this doesn’t work because it is looking for a sheet called ‘A30’.
It works by clicking ‘replace’ and changing everything that says ‘Pricing Calculator’ to ‘Option 2’ or whatever. But I have got to password protect all of the sheets so that no one can change them, therefore I can’t use the replace method!
Does anyone have any ideas as to what I could do? I would prefer to avoid using macros or VBA if possible.
You could use INDIRECT() for this.
=INDIRECT("'" & A30 & "'!A1")