MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old Apr 23rd, 2002, 06:56 AM   #1
HunterN
Board Regular
 
HunterN's Avatar
 
Join Date: Mar 2002
Location: Maryland
Posts: 424
Default

Hi!

I have several workbooks. One is the master workbook that will hold data from several seperate workbooks. I want to use the VLOOKUP function as I move down the rows in the master workbook, the thing is, that means that the table-array (or the workbook that I am searching) will change for each row I go to. I am trying to find an example of how to make a dynamic variable for the table-array that will allow me to change this variable for each row.

This is what I am thinking:

VLOOKUP($C$3, _
'C:My Project["0251.xls"]Sheet1! $A$3:$D$52,2,false)

The "0251.xls" will change for each row I read

Have any suggestions? Thanks

[ This Message was edited by: HunterN on 2002-04-23 05:57 ]
HunterN is offline   Reply With Quote
Old Apr 23rd, 2002, 07:23 AM   #2
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
Default

Quote:
On 2002-04-23 05:56, HunterN wrote:
Hi!

I have several workbooks. One is the master workbook that will hold data from several seperate workbooks. I want to use the VLOOKUP function as I move down the rows in the master workbook, the thing is, that means that the table-array (or the workbook that I am searching) will change for each row I go to. I am trying to find an example of how to make a dynamic variable for the table-array that will allow me to change this variable for each row.

This is what I am thinking:

VLOOKUP($C$3, _
'C:My Project["0251.xls"]Sheet1! $A$3:$D$52,2,false)

The "0251.xls" will change for each row I read

Have any suggestions? Thanks

[ This Message was edited by: HunterN on 2002-04-23 05:57 ]
=VLOOKUP($C$3,INDIRECT("'["&E1&"]Sheet1'!$A$3:$D$52"),2,0)

where E1 houses a file name like 0251.xls.

The files in which you look up must be open.

Aladin
Aladin Akyurek is offline   Reply With Quote
Old Apr 23rd, 2002, 09:32 AM   #3
HunterN
Board Regular
 
HunterN's Avatar
 
Join Date: Mar 2002
Location: Maryland
Posts: 424
Default

Aladin,

What if the Project Number is in the column
I will be looking at. How can I get this value to be the lookup variable in the VLOOKKUP table?

Thanks, Nancy
HunterN is offline   Reply With Quote
Old Apr 23rd, 2002, 10:29 AM   #4
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
Default

Quote:
On 2002-04-23 08:32, HunterN wrote:
Aladin,

What if the Project Number is in the column
I will be looking at. How can I get this value to be the lookup variable in the VLOOKKUP table?

Thanks, Nancy
I don't think I understand. Care to elaborate a bit? Are you referring to $C$3?

Aladin Akyurek is offline   Reply With Quote
Old Apr 23rd, 2002, 10:56 AM   #5
HunterN
Board Regular
 
HunterN's Avatar
 
Join Date: Mar 2002
Location: Maryland
Posts: 424
Default

Yes, actually it is cell $E$3 that will have the project Lookup value, but this value is also the Workbook name.

Example: if Project Name (cell E3) has 0251 this is the lookup value I want to use in the VLOOKUP table and it it also the name of the workbook that I need to search in. Hope that makes some sence.

Thanks for you help, Nancy
HunterN is offline   Reply With Quote
Old Apr 23rd, 2002, 10:59 AM   #6
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
Default

Quote:
On 2002-04-23 09:56, HunterN wrote:
Yes, actually it is cell $E$3 that will have the project Lookup value, but this value is also the Workbook name.

Example: if Project Name (cell E3) has 0251 this is the lookup value I want to use in the VLOOKUP table and it it also the name of the workbook that I need to search in. Hope that makes some sence.

Thanks for you help, Nancy
Would this

=VLOOKUP(E3,INDIRECT("'["&E3&".xls"&"]Sheet1'!$A$3:$D$52"),2,0)

work?

Aladin
Aladin Akyurek is offline   Reply With Quote
Old Apr 23rd, 2002, 11:23 AM   #7
HunterN
Board Regular
 
HunterN's Avatar
 
Join Date: Mar 2002
Location: Maryland
Posts: 424
Default

I entered this as the formula:


=VLOOKUP(E3,INDIRECT("'["&E3&".xls"&"]Project'!$A$1:$AJ$30"),4,FALSE)

Got this back #VALUE!
HunterN is offline   Reply With Quote
Old Apr 23rd, 2002, 12:07 PM   #8
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
Default

Quote:
On 2002-04-23 10:23, HunterN wrote:
I entered this as the formula:


=VLOOKUP(E3,INDIRECT("'["&E3&".xls"&"]Project'!$A$1:$AJ$30"),4,FALSE)

Got this back #VALUE!
I just constructed two WBs in order to test the above.

In E3 (a text-formatted cell) I have the entry 0251.

I created a WB named 0251.xls.

In A3 in sheet Project of this WB (column A preformatted as text) I have the entry 0251. In D3 (column 4) I have just an arbitrary value "London".

In WB 1, the formula

=VLOOKUP(E3,INDIRECT("'["&E3&".xls]Project'!$A$1:$AJ$30"),4,0)

gives me "London" as result.

BTW: 0 means FALSE, so that's not the issue. Although this formula looks a bit different what you have tried, they are equivalent (I tested this).

Is what you have tried including the set up/layout of the workbooks any different from the test situation I just described?
Aladin Akyurek is offline   Reply With Quote
Old Jun 14th, 2010, 09:47 AM   #9
erashish14
New Member
 
Join Date: Jun 2010
Posts: 1
Smile Re: Variables in VLOOKUP

Hi,

I've Question, i want to use loop variable in Vlookup,

e.g. =VLOOKUP(E4,R[-3108]C:R[-11]C[53],1,FALSE)

Can i use variable in "Lookup_Value" in place of E4, like if i defined one variable like RAW, which varies from 1 to 4, how can i place it in "Lookup_Value"
& also in "Col_Index_Num". so that these values gets automatically changed when values changes from 1 to 4, meeting certain condition.

Thanks in Advance
Ashish
erashish14 is offline   Reply With Quote
Old Jan 14th, 2011, 10:52 AM   #10
HunterN
Board Regular
 
HunterN's Avatar
 
Join Date: Mar 2002
Location: Maryland
Posts: 424
Smile Re: Variables in VLOOKUP

Just an update to this post.

Here is what I finally put in my code to achieve what I needed to do.

Code:
      sheetName = "My Project List"
      myWkbk = FYdir & "_List.xlsx"
      holdStr = myPath & "\" & FYdir & "\[" & myWkbk & "]" & sheetName
      Cells(2, 3).Formula = "=VLOOKUP($C$3,'" & holdStr & "'!Database,2,FALSE)"
Where Database is a DefineNamed Range.

Nancy
HunterN is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 02:28 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes