Looking to get a range from another sheet based upon the Column Letter which is obtained from the current sheet.
So say that I designate A2 on the current sheet to the letter G.
I would then ask A10 to =AVERAGE('Sheet1'!(A2)2:(A2)999)
So essentially it would be =AVERAGE('Sheet1'!G2:G999)
However, this doesn't work. Anyone have any idea how to make this worK?
You would use the Indirect() function:
=AVERAGE(INDIRECT("'Sheet1'!" & A2 & "2:" & A2 & "999"))
Related
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
This is a really basic question but I can't get it done.
All I want is to be able to input the value of a cell from another workbook. However, the sheet is dynamically determined.
For example, I have my current workbook with A1=January, A2=3 and A3=33. It means I want to get the value of C33 in the sheet January of the workbook also named January.xlsx.
Here is what I currently have:
ADDRESS(3;33;1;1;"'N:\[" & A1 & ".xlsx"]" & A1 & "'")
It gives me a #REF! error.
And I have no idea how to evaluate the result address after, I tried:
INDIRECT('N:\[January.xlsx]January'!C33)
... but it also gives me a #REF! error. What am I doing wrong?
1) Address Uses Row,Column Number as parameters
ADDRESS(row_num,column_num,abs_num,a1,sheet_text)
so your ADDRESS Formula will be
=ADDRESS(A3,A2,1,1,"N:\["&A1&".xlsx"&"]"&A1)
2) Indirect needs the external workbook to be open
If the external workbook is closed then copy the output of the Address as value and add =
For e.g.
using the address formula as shown above will give the result
'N:\[January.xlsx]January'!$C$33
Copy this value into a new column ,Paste as Value and add =
='N:\[January.xlsx]January'!$C$33
will get the value from the external workbook
With A1=January, A2=C and A3=33 and with January.xlsx open, in A4 enter:
="[" & A1 & ".xlsx" & "]" & A1 & "!" & A2 & A3
and in A5 enter:
=INDIRECT(A4)
Remember January.xlsx must be open.
This should be a simple process, but I am having difficulty producing the right outcome. I am trying to combine three cells into one, with Alt + Enter or Char(10) separating each value. When I use a simple Excel formula =B2 & Char(10) & C2 & Char(10) & D2 and wrap the text of the destination cell, everything seems normal. But if I try to search for a string in that cell (for example, "WS001"), it won't find the correct string. If I use VBA to perform the same function (i.e. ThisWorkbook.Worksheets("Sheet1").Cells(2, 1) = Cells(2, 2) & Chr(10) & Cells(2, 3) & Chr(10) & Cells(2, 4)), I can then search for the string in B2 and it fill find it.
That problem was addressed (to a degree), but then when I try to link the destination cell to a cell in a different Worksheet (=Sheet1!A2), I encounter the same issue where the search function can't find the string. Is there another method of doing this (I'd like to avoid VBA, because if someone has to edit the file/information in the future, they might not know how to change it)?
Can you clarify what you are looking for based on this example? Column A is the catenation of the three columns to the right, with CHAR(10).
Would you be for example searching for "Shane"? What result would you want?
EDIT
I'm having trouble understanding what you're looking for, but hopefully this can send you in the right direction.
This is my result:
B1 is the data to be searched for
The catenated formula is as follows: (This also worked when they were on a different sheet)
=C6 & CHAR(10) & D6 & CHAR(10) & E6
The "Catenated result" search formula is an array formula (ControlShiftEnter to enter formula)
="Row "&MATCH(TRUE,ISNUMBER(FIND($B$1,A6:A8)))
The "Individual result" search formula is also an array formula (ControlShiftEnter to enter formula)
="Column "&MAX(($B$1=C6:E8)*COLUMN(C6:E8))-2
(the minus 2 is because the first Source Value" column is column C (ie 3)
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.
In excel 2007, I have a formula in a cell like the following:
=COUNTIFS('2008-10-31'!$C:$C;">="&'$A7)
Now I want to make the name of the sheet ('2008-10-31') be dependent on the value of some cell (say A1). Something like:
=COUNTIFS(A1!$C:$C;">="&'$A7) // error
Is there is way to do this? Or do I have to write a VBA-Macro for it?
INDIRECT does what you want. Note that if the sheet name has any spaces, you need to put single quotes round it, ie
=COUNTIFS(INDIRECT("'" & A1 & "'!$C:$C"); ">=" & $A7)
You are looking for the INDIRECT worksheet function:
=INDIRECT("SHEET2!A1")
=COUNTIFS(INDIRECT(A1 & "!$C:$C"); ">=" & $A7)
The function turns a string into a real cell reference.