I have information held in a separate worksheet and the name of the worksheet
is changing constantly. Within a cell on my current worksheet I have the
file details of where the information I require is to be obtained. I want to
create a formula that takes the file details from the cell above and adds it
to the formula so it knows where to find the information i require
Hi Paul
You want to use the INDIRECT Worksheet Function
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: www.mvps.org/dmcritchie/excel/excel.htm
Search Page: www.mvps.org/dmcritchie/excel/search.htm
quot;Paul Bondquot; gt; wrote in message ...
gt; I have information held in a separate worksheet and the name of the worksheet
gt; is changing constantly. Within a cell on my current worksheet I have the
gt; file details of where the information I require is to be obtained. I want to
gt; create a formula that takes the file details from the cell above and adds it
gt; to the formula so it knows where to find the information i require
Do you mean that the worksheet (tab) name is constantly changing, or
that the workbook (file) name is changing? If the sheet name is being
changed, you can overcome this by using a named range for the
information. If the filename is being changed, then the cell in your
current worksheet that holds this will need to change also.
You are a bit vague in describing the quot;informationquot; you require. Is
this a single cell whose value you want to return, or could it be a
table that you want a lookup formula to access? You can refer to a
location in another file by means of:
[filename.xls]sheet_name!cell_reference
but depending on how you want to access this you will probably also
need to make use of the INDIRECT( ) function.
Hope this helps.
PeteThe contents of a cell in my spreadsheet contains a file and worksheet
reference eg
[china garden week 74.xls]Sheet1!$D$15
The contents of this cell is updated by a formula each time the week number
changes. Therefore the number quot;74quot; is always changing
I want to enter a formula to return the value in the worksheet cell stated
above without having to amend the formula each time the filename changes.
I hope this makes more sense. Thanks for your help
quot;Petequot; wrote:
gt; Do you mean that the worksheet (tab) name is constantly changing, or
gt; that the workbook (file) name is changing? If the sheet name is being
gt; changed, you can overcome this by using a named range for the
gt; information. If the filename is being changed, then the cell in your
gt; current worksheet that holds this will need to change also.
gt;
gt; You are a bit vague in describing the quot;informationquot; you require. Is
gt; this a single cell whose value you want to return, or could it be a
gt; table that you want a lookup formula to access? You can refer to a
gt; location in another file by means of:
gt;
gt; [filename.xls]sheet_name!cell_reference
gt;
gt; but depending on how you want to access this you will probably also
gt; need to make use of the INDIRECT( ) function.
gt;
gt; Hope this helps.
gt;
gt; Pete
gt;
gt;
Ok, thanks for coming back with more detail. As you have spaces in your
filename, you will need to wrap apostrophes around this and the sheet
name so that you have:
'[china garden week 74.xls]Sheet1'!$D$15
Is this something your formula in this cell can (be amended to) do? If
so, and assuming the formula is in cell A1, then you could enter this
formula in the cell where you want the extracted data to appear:
=INDIRECT(A1)
Be warned, however, that INDIRECT( ) cannot get data from a file which
is not open.
Hope this helps.
PeteThanks Pete. The next problem will be that none of the files that I want to
link to will be open. Is there anyway around this?
quot;Petequot; wrote:
gt; Ok, thanks for coming back with more detail. As you have spaces in your
gt; filename, you will need to wrap apostrophes around this and the sheet
gt; name so that you have:
gt;
gt; '[china garden week 74.xls]Sheet1'!$D$15
gt;
gt; Is this something your formula in this cell can (be amended to) do? If
gt; so, and assuming the formula is in cell A1, then you could enter this
gt; formula in the cell where you want the extracted data to appear:
gt;
gt; =INDIRECT(A1)
gt;
gt; Be warned, however, that INDIRECT( ) cannot get data from a file which
gt; is not open.
gt;
gt; Hope this helps.
gt;
gt; Pete
gt;
gt;
Hoping this is not too off-subject, but I'm having a problem with a
similar formula. I've created the formula by using concatenate to
create the reference to a cell in another spreadsheet, and then copied
and Paste/Special/Values the result of the Concatenate. I end up with
what I want, a formula such as ='c:\[385.xls]sheet1'!$l$4 but Excel
doesn't recognize the formula until I select the cell, hit F2 to edit,
and press Enter. Until I do that it just displays the formula itself
and not the result. I'd rather not do F2, Enter, several thousand
times to get it to recognize all my formulas. Is there another way to
get it to recognize the formulas?
Thanks.Is your macro populating the cell with
cell.formula as opposed to cell.value
.value is the default.
Select an empty cell (no content, no spaces, no formulas
to use cell M1 it must test True for =ISBLANK(M1)
Copy that cell, then
Select the range you want to fix, can be the entire column(s)
Edit, Paste Special, Add
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: www.mvps.org/dmcritchie/excel/excel.htm
Search Page: www.mvps.org/dmcritchie/excel/search.htm
gt; wrote in message oups.com...
gt; Hoping this is not too off-subject, but I'm having a problem with a
gt; similar formula. I've created the formula by using concatenate to
gt; create the reference to a cell in another spreadsheet, and then copied
gt; and Paste/Special/Values the result of the Concatenate. I end up with
gt; what I want, a formula such as ='c:\[385.xls]sheet1'!$l$4 but Excel
gt; doesn't recognize the formula until I select the cell, hit F2 to edit,
gt; and press Enter. Until I do that it just displays the formula itself
gt; and not the result. I'd rather not do F2, Enter, several thousand
gt; times to get it to recognize all my formulas. Is there another way to
gt; get it to recognize the formulas?
gt;
gt; Thanks.
gt;
I think I'm working more simply than what you may think. I'm not using
macros and wouldn't know where to begin doing it that way.
What I have is a range of numbers in column A (say, 1 through 1000).
Cell B1, I have =CONCATENATE(quot;='c:\[quot;,A1,quot;.xls]sheet1'!$l$4quot;), B2
reference A2 and so on... So, I have that formula in column B, 1
through 1000. I then copy B1:B1000 and Paste, Special, Values in
column C, which gets me to where Excel just displays the formula in
column C until I select each cell and do the F2, Enter.
I tried pasting from column B into a blank cell (tested with ISBLANK)
using the Paste Special, Add and ended up with a #VALUE! error and cell
contents of =0 (CONCATENATE(quot;='c:\[quot;,H18,quot;.xls]sheet1'!$l$4quot;)I hope you got rid of the =0 bit.
If you still have the formulas visible rather than the result,
highlight column C, go to Data | Text-toColumns then click Finish.
This should give you the results you are looking for, rather than
having to edit 1000 cells.
Hope this helps.
Pete
- Mar 13 Thu 2008 20:42
Adding Contents of a cell to a formula
close
全站熱搜
留言列表
發表留言