SOLVED

VLOOKUP and using Table_Array for looking up a file

%3CLINGO-SUB%20id%3D%22lingo-sub-2030328%22%20slang%3D%22en-US%22%3EVLOOKUP%20and%20using%20Table_Array%20for%20looking%20up%20a%20file%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2030328%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%20I'm%20amending%20an%20existing%20VLOOKUP%20command%20which%20reads%20in%20status%26nbsp%3Bdata%20(for%26nbsp%3Ba%20Company%20%26amp%3B%20Tranche)%20from%20a%20file%20stored%20on%20another%20server%20and%20displays%20the%20data.%20The%20Table_Array%20is%20hard-coded%20eg%20%3A%3C%2FP%3E%3CP%3E%3DIFERROR(VLOOKUP(%24B19%2C'%5C%5CBxxxfp1c%5Cwrkgroup%5CXX%20ESS%5CFXXXX_Upgrade_Checklist%5CTranche%2002%5C%5BT02-Laxxxx-CM%20Checklist.xlsx%5DSheet1'!%24D%3A%24J%2C7%2CFALSE)%2C%22NO%20DATA%22).%3C%2FP%3E%3CP%3EI%20want%20to%20replace%20the%20Table_Array%20e.g.%20%22'%5C%5CBxxxfp1c%5Cwrkgroup%5CXX%20ESS....%22%20with%20a%20VLOOUP%20on%20a%20sheet%20in%20my%20spreadsheet%20(called%20Client%20Setup)%20where%20I%20can%20define%20the%20file%20and%20path%20for%20each%20company%20and%20tranche%2C%20e.g.%3C%2FP%3E%3CP%3E%26nbsp%3B%3DIFERROR(VLOOKUP(%24B15%2CVLOOKUP(E2%2C'Client%20Setup'!%24A%244%3A%24O%24220%2C11%2CFALSE)%2C7%2CFALSE)%2C%22NO%20DATA%22).%3C%2FP%3E%3CP%3EIf%20I%20hard%20code%20the%20value%20the%20VLOOKUP%20works%20but%20not%20in%20the%20syntax%20above%2C%20I%20just%20get%20back%20%22NO%20DATA%22%20%26nbsp%3B(I've%20checked%20the%20VLOOKUP%20on%20E2%20is%20correct.).%26nbsp%3B%20Can%20someone%20explain%20what%20I'm%20doing%20wrong%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20reason%20for%20doing%20this%20is%20that%26nbsp%3BI%20want%20to%20remove%20the%20hard%20coding%20and%20instead%20users%20just%20need%20to%20maintain%20the%20Client%20Setup%20file%20without%20changing%20the%20code%20(other%20than%20Company%20Name%2FTranche).%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2030328%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2030386%22%20slang%3D%22en-US%22%3ERe%3A%20VLOOKUP%20and%20using%20Table_Array%20for%20looking%20up%20a%20file%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2030386%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F917517%22%20target%3D%22_blank%22%3E%40Jit_Bristol%3C%2FA%3E%26nbsp%3Bthe%20return%20from%20your%20inner%20VLOOKUP%20is%20just%20a%20string%20value%20not%20a%20proper%20reference.%26nbsp%3B%20You%20could%20add%20an%20INDIRECT()%20but%20the%20file%20will%20need%20to%20be%20open%20for%20that%20INDIRECT%20to%20work%3A%3C%2FP%3E%3CP%3E%3CSPAN%3E%3DIFERROR(VLOOKUP(%24B15%2CINDIRECT(VLOOKUP(E2%2C'Client%20Setup'!%24A%244%3A%24O%24220%2C11%2CFALSE))%2C7%2CFALSE)%2C%22NO%20DATA%22).%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Hi, I'm amending an existing VLOOKUP command which reads in status data (for a Company & Tranche) from a file stored on another server and displays the data. The Table_Array is hard-coded eg :

=IFERROR(VLOOKUP($B19,'\\Bxxxfp1c\wrkgroup\XX ESS\FXXXX_Upgrade_Checklist\Tranche 02\[T02-Laxxxx-CM Checklist.xlsx]Sheet1'!$D:$J,7,FALSE),"NO DATA").

I want to replace the Table_Array e.g. "'\\Bxxxfp1c\wrkgroup\XX ESS...." with a VLOOUP on a sheet in my spreadsheet (called Client Setup) where I can define the file and path for each company and tranche, e.g.

 =IFERROR(VLOOKUP($B15,VLOOKUP(E2,'Client Setup'!$A$4:$O$220,11,FALSE),7,FALSE),"NO DATA").

If I hard code the value the VLOOKUP works but not in the syntax above, I just get back "NO DATA"  (I've checked the VLOOKUP on E2 is correct.).  Can someone explain what I'm doing wrong?

 

The reason for doing this is that I want to remove the hard coding and instead users just need to maintain the Client Setup file without changing the code (other than Company Name/Tranche).

6 Replies
best response confirmed by Jit_Bristol (New Contributor)
Solution

@Jit_Bristol the return from your inner VLOOKUP is just a string value not a proper reference.  You could add an INDIRECT() but the file will need to be open for that INDIRECT to work:

=IFERROR(VLOOKUP($B15,INDIRECT(VLOOKUP(E2,'Client Setup'!$A$4:$O$220,11,FALSE)),7,FALSE),"NO DATA").

Hiya
Thanks for the speedy reply and also why the syntax as I had it doesn't work. I tried the INDIRECT syntax as suggested and as you said the file needs to be open for the command to work. This would be problematic as there would be multiple users and not sure it would be practical to ask them to open each file required. I haven't got too much to spend it on it right now so will leave code as it is and have to hard code the file names in.
Kind Regards,
Jitesh

@Jit_Bristol A couple things to note:

using the INDIRECT() means the file must be open which also means you don't need the full address (just the file name is sufficient)

 

if you really want to avoid INDIRECT() you can use the hard coded address to essentially copy the needed data from each of those sheets into this workbook and then do the look up within this workbook.  I hesitate to mention this as you indicated there are many other workbooks and I fear this could cause significant lags and performance issues.  But in concept you could, in Client Setup instead of just the text path reference you have each row become 2 rows with the client in the first column and then in the second column you have these formulas

=TRANSPOSE('\\Bxxxfp1c\wrkgroup\XX ESS\FXXXX_Upgrade_Checklist\Tranche 02\[T02-Laxxxx-CM Checklist.xlsx]Sheet1'!$D1:$D1000)

=TRANSPOSE('\\Bxxxfp1c\wrkgroup\XX ESS\FXXXX_Upgrade_Checklist\Tranche 02\[T02-Laxxxx-CM Checklist.xlsx]Sheet1'!$J1:$J1000)

Now I chose rows 1:1000 but you might need more (or less would be better or you dynamically find the size of the data and use that).  But now that you have the relevant data you can now use HLOOKUP with an OFFSET or INDEX-MATCH combo to find the data you want.  You could also (or if the data sets are really big might have to) reorganize the Client Setup sheet to be in columns so clients go across row 1 and every 2 columns is a new client with the source data copied over (i.e. remove the TRANSPOSE from the above equations and put them in row 2 under the client name)

 

last, another option would be to create a custom macro that would update the data based on a particular event or events (e.g. on workbook open and if they update a particular cell or cells)

@mtarler Thanks for the follow-up. As this spreadsheet will cover multiple clients and tranches there will be a large number of workbooks created so I think performance would be an issue. Also this specific task is one of many other, non-spreadsheet, related tasks I'm doing for the client so time willing I will try out your suggested method (I like a technical challenge!).  Appreciate the time you have given to come back with the alternative solution.

You're welcome and best of luck.