Evaluate an address - excel-formula

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.

Related

get the value of a cell in a different worksheet by referring the name of the worksheet contains in some other cell

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)

Reference external workbook with multiple sheets

I have this excel formula which works perfectly to lookup a value in A1 from multiple sheets provided those sheets are on the same spreadsheet. I would like to extend it so it searches from an external spreadsheet where sheet_list is a list of sheet names on the external spreadsheet. Please help.
=LOOKUP(9.99999999999999E+307,1/COUNTIF(INDIRECT(" ' " &sheets_list&" '!A:A"),$A1),sheets_list)
I do exactly this :
IFERROR(INDIRECT("'" & $A$1 & $B$1 & $C$1 & "'!"&B$3 & ($A4+6) ),"file closed")
the cells a1, b1, c1 contain the path and file name detail, so all you need is to add your path / filename before the first ampersand in your expression.
Got it to work in this way:
=LOOKUP(9.99999999999999E+307,1/COUNTIF(INDIRECT("'[external_workbook_filename]" &sheet_names_array&"'!A:A"),$A1),sheet_names_array)

Get Range From A Separate Sheet Using a Variable in Excel

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"))

How to use a cell as a filename in a reference in excel?

If I have a cell, "a2" which has part of a filename/filepath, "sheet2.xlsx" in it which I want to use as a reference another workbook, how can I accomplish this?
I have tried using the INDIRECT function but always get a reference error.
I am trying to find a way to summarize a list of spreadsheets with column a containing the spreadsheet name and another column referencing a cell inside that respective sheet.
If the referenced workbook is open, then here is an example of getting a value from it:
=INDIRECT( "'" & A1 & "[" & B1 & "]" & C1 & "'!" & D1)
where the components are like:
Note we have specified:
the path
the filename
the worksheet name
the cell address
If the file is not open, you can still retrieve data with a ExecuteExcel4Macro (assuming you have a version of Excel that supports this function) For an example of this type of code, see:
Get Data from External Files

Dynamic INDIRECT formula with range

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.

Resources