I have a worksheet in which I want to add vlookup function where the table array will be taken dynamically from concatenated path.
I want to store the path in one cell, the filename prefix in another cell, the file name suffix in a 3rd cell and the sheet and range in a 4th cell.
How to do that?
Thanks
Originally Posted by orit
![]()
Sorry... do not understand your Q... can you post an example?
Say the 4 cells are A1, B1, C1, and D1
To concatenate them use the "&" symbol. So...
=A1 & B1 & C1
should give you the full path of whatever you're wanting. Then D1 still has the sheet and range of the desired data.
I hope this helps!
starryknight64
I succeed to get the full path by using the "&" sign or the CONCATENATE function, but doesn't succeed to use it as the table array of VLLOKUP function. For example I have the following table:
A | B | C | D | E
-------------------------------------------------------------
path | file_prefix | file_version | sheet_name | range
--------------------------------------------------------------
D:\Test\ | CP_Desc_ | 21 | process A | $A$4:$AA$202
I want to get the function:
by instead giving the explicit path: D:\Test\[CP_Desc_21.xls]process A'!$A$4:$AA$202 , concatenate it from the different cells. I tried:=VLOOKUP($D24,'D:\Test\[CP_Desc_21.xls]process A'!$A$4:$AA$202,3,0)
But I get #VALUE!.=VLOOKUP($D26,CONCATENATE("'",A2,"[",B2,C2,".xls]",D2,"'","!",E2),3,0)
What is the problem? any solution?
Thanks a lot
You will probably need to concatenate the full path-range in a cell and then use VLookup(value,Indirect(cell),col-index,type)Originally Posted by orit
---
Si fractum non sit, noli id reficere.
When I try the following:
While the cell F21 contains the full path range as formated in vlookup (the result of the concatenate function as desplayed in cell F21 is:=VLOOKUP($D25,$F$21,3,0)
But is still doesn't work. any idea?'D:\Test\[CP_Desc_21.xls]process A'!$A$4:$AA$202
Thanks
Yes, the format is badOriginally Posted by orit
Try my suggestion ofwhere $D25 appears to be your value, $F$21 appears to be your cell, 3 appears to be your co-index, and 0 appears to be your True-False type.VLookup(value,Indirect(cell),col-index,type)
Let me know how you go
---
Si fractum non sit, noli id reficere.
Oh, I understand, to use the function "INDIRECT".
When i try the following:
while the cell F21 holds the result of a concatenate function which is:=VLOOKUP($D9,INDIRECT($F$21),3,0)
'D:\Test\[CP_Desc_21.xls]process A'!$A$4:$AA$202
I get the result: #REF!
What can be the reason. What is wrong?
Thanks
="'C:\Excel\[Book1.xls]Sheet1'!A1:D4"Originally Posted by orit
with
=VLOOKUP($D9,INDIRECT($F$21),3,FALSE)
works if the book is open, #REF if closed.
hth
---
Si fractum non sit, noli id reficere.
So I have been scouring blogs and maybe what I want to do is impossible.
What I want is exactly what this poster asked for.
Create a file name on the fly
vlookup information in that file.
The solution posted above was that you have to store the file name in an intermediate cell and then use indirect. Why that is, I have no idea. It sure seems that the original Concatenate solution should have worked.
Regardless, this only works if the file is open. Otherwise you get #REF errors.
Indirect does not work on closed files.
I have a years worth of files.
I do not/can not/ manually open them all before doing this operation.
So I need to expand the problem
Does anyone know how to
Create a file name on the fly
vlookup information in that file.
AND work on closed files.
Add 0 to the cell that you have performed the concatenate formula.
Then do the vlookup from the cell that you have added 0.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks