As you can see in the image or formula below, I am writing a series of formulas that are referencing the sheet "Lulu." Instead of rewriting "Lulu" over and over, I would like to write Lulu once in cell B1 and reference cell B1 inside the formula.
=AVERAGE(LULU!$C$4:$C$5)/AVERAGE(LULU!$D$4:$D$5)-1
Use INDIRECT(), but this will be longer:
=AVERAGE(INDIRECT("'" & B1 & "'!$C$4:$C$5"))/AVERAGE(INDIRECT("'" & B1 & "'!$D$4:$D$5"))-1
Related
I have 4 sheets in this sample, each with a value in A1, as follows:
Sheet1 - A1=18
Sheet2 - A1=15
Sheet3 - A1=197
Sheet4 - A1=534
Then in Sheet5 I have:
B1='Sheet1
B2='Sheet4
I want an average of A1 cells from Sheet1 to Sheet4, and I can accomplish this easily with the formula =AVERAGE(Sheet1:Sheet4!A1) in Sheet5!A1.
My problem is I want to do that same formula but referencing the sheet values in B1 and B2. I think I need INDIRECT for this, so I tried =AVERAGE(INDIRECT(B1 & ":" & B2 & "!A1")). When I enter that, though, I get a #REF! error. What could Excel be failing to reference?
Try this formula, Workbook
=AVERAGE(INDIRECT("'"&"Sheet"&ROW(INDIRECT(SUBSTITUTE($B$1,"Sheet","")&":"&SUBSTITUTE($B$2,"Sheet","")))&"'!"&CELL("address",A1)))
I want to get the value of a cell in a different worksheet by referring the name of the worksheet contains in some other cell.
For an instance, I have this formula to get the value from a cell from another sheet ='Sheet2'!H25. But I want to replace the 'Sheet2' of the formula of a cell contains the text "sheet2".
Cell A25 contains the name of a sheet titled "Sheet2" which I got from the formula =MID(CELL("filename", A1),FIND("]",CELL("filename", A1))+1,31)
So, instead of ='Sheet2'!H25 I tried the formula =INDIRECT("'" A25 & "'!" & H25) But it doesn't work. How to make it work.
P.S: A25 is in the Sheet1 and H25 is in the sheet2
You just forgot to double-quote H25 .
Either:
=INDIRECT("'" & A25 & "'" & "!" & "H25")
or
=INDIRECT("'" & A25& "'!H25")
(the second equation combines the various parts after the sheet-name)
I am trying to create a hyperlink in Excel that references a cell on my worksheet, to get the sheet name.
Here is the working formula, with a static value.
=HYPERLINK("[\\xxxfs01\xxxxxxxx\IT\Monthly Reporting\Data\Computers Report for xxxDMZWSUS01.xls]Sheet1!A1","CLICK HERE")
When I use INDIRECT to reference a dynamic value, the cell just shows a value of #VALUE!
Here is what I have tried.
=HYPERLINK(INDIRECT("""&[\\xxxfs01\STS-Defence\IT\Monthly Reporting\Data\Computers Report for xxxDMZWSUS01.xls]"&[#Sheet]&"!A1&""","CLICK HERE"))
=HYPERLINK(INDIRECT(CHAR(34)&"[\\xxxfs01\STS-Defence\IT\Monthly Reporting\Data\Computers Report for xxxDMZWSUS01.xls]"&"Sheet1"&"!A1"&CHAR(34),"CLICK HERE"))
Can anyone help with the correct syntax?
You don't need INDIRECT to put together a Hyperlink location (INDIRECT is specifically intended to allow you to change the cell being reference in a formula, and that's not what I think you're trying to do). I'm listing steps below, because I think it might be a tiny bit confusing what you are trying to do, so this gives you a chance to see if I understood your problem correctly.
You are in Worksheet1.xlsx, Sheet1
In cell B2 of Sheet1, you want to enter the name of a worksheet from a different file: Computers Report for xxxDMZWSUS01.xls
In cell B3 of Sheet1, you have a hyperlink to go to cell A1 of the worksheet named in cell B2
The formula in B3 should be:
=HYPERLINK("[\\xxxfs01\xxxxxxxx\IT\Monthly Reporting\Data\Computers Report for xxxDMZWSUS01.xls]"&B2&"!A1","CLICK HERE")
INDIRECT Worksheet Function
Returns the reference specified by a text string. References are immediately evaluated to display their contents. Use INDIRECT when you want to change the reference to a cell within a formula without changing the formula itself.
An example of using INDIRECT and HYPERLINK is:
=IF(TRIM(A2)="","",IF(ISERROR(INDIRECT("'" & A2 & "'!$A$1")),"missing",
HYPERLINK("#" & "'" & A2 & "'!$A$1",INDIRECT("'" & A2 & "'!$B$2")) ))
Reference is http://dmcritchie.mvps.org/excel/indirect.htm
Suppose I have a bunch of sheets, named uninterestingly Main and then ModelA, ModelB, ... In Main, I just want to aggregate the models on these various sheets.
How can I structure it so that if cell A1 contains the name of a sheet (e.g. ModelA) then cell B1 contains the value of C14 in the cell in the sheet referenced by A1. (Explicitly, this would be ='ModelA'!C14, but I don't want to be explicit).
So you will have the Sheet name in column A and want to see whatever sheet that is, but cell C14's value?
=INDIRECT("'"&A1&"'!C14")
Actually, I think this is what you want based on your question:
=INDIRECT("'" & A1 & "'!" & B1)
I have some dynamic input, in my case, the name of the month in cell I25. Based on the month the function in cell H32 should reference a sheet with the name of the month and cell A18 within that sheet. Now this I can handle and have made it possible through the INDIRECT function.
The issue I'm having is with dynamic range. For example, I would like cell H33 to reference cell A19 within the worksheet "February". The closest I got to it was =INDIRECT($I$25"&"!A18:A200"). And it seems to be working, but for some strange reason it starts referencing the cells contents from A36 onwards, which I don't get. Suggestions?
Any help would be greatly appreciated.
Use this one in H32 and drag it down:
=INDIRECT("'" & $I$25 & "'!" & CELL("address",A18))
Notes:
I've changed $I$25 & "!" to "'" & $I$25 & "'!" in formula to make it more reliable (for the case when sheet name contains spaces you should include your sheet name in single quotes like this: 'My sheet'!A18)
In H32 this formula evaluates to =Feb!A18 (where Feb is your sheet name), in H33 to =Feb!A19 and so on.