MrExcel Message Board
Support This Site


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 Aug 16th, 2005, 04:32 PM   #1
Yogi Bear
 
Join Date: Aug 2005
Location: Looking at the beach right now
Posts: 8
Default Big Nested IF functions

Hi there,

Just when I was about to give up, I found this forum. After reading a number of posts I feel that someone may be able to assist me.

I am writing a forecasting and planning tool for the hospitality industry.

My worksheet makes reference to at least 18 external spreadsheets and I need to be able to pull up an external cell reference based on on a user defined series (using drop down lists / forms).

So currently there are 18 variations on the source of the data, and the only way I can think of to look up the corresponding reference is through an 18 level nested function. I say this because I am not familiar with any methods for using LOOKUP functions to refer to external workbooks.

I have tried a variety of semi-creative solutions, but all rely on heavy nesting.

Can anyone please assist me by giving advice on how to create LOOKUP tables that refer to an external workbook/sheet as part of a string followed by a particular cell reference.

I can provide more details and code if necessary.

Thanking you in advance,

Yogi Bear - newbie
Yogi Bear is offline   Reply With Quote
Old Aug 16th, 2005, 04:46 PM   #2
SteveO59L
 
Join Date: Apr 2004
Posts: 5,530
Default

Vlookup takes a form something like this



vlookup("the index field","in worksheet range","return value from column n in that range")
SteveO59L is offline   Reply With Quote
Old Aug 16th, 2005, 04:47 PM   #3
Joe4
MrExcel MVP
Moderator
 
Joe4's Avatar
 
Join Date: Aug 2002
Posts: 16,450
Default

Take a look at the VLOOKUP function in Excel's help. It gives details, examples, and tips on how to set it up.
__________________
TIPS FOR FINDING EXCEL SOLUTIONS
1. Use the built-in Help that comes with Excel/Access
2. Use the Search functionality on this board
3. A lot of VBA code can be acquired by using the Macro Recorder.
Joe4 is offline   Reply With Quote
Old Aug 16th, 2005, 04:48 PM   #4
Yogi Bear
 
Join Date: Aug 2005
Location: Looking at the beach right now
Posts: 8
Default Thanks Steve

Thanks for your reply steve,

I'm still confused. Following is the code if it assists. Note the external references.

=+IF($G$1="av23",'[Avillion.xls]2002-2003'!C12,IF($G$1="av34",'[Avillion.xls]2003-2004'!C12,IF($G$1="av45",'[Avillion.xls]2004-2005'!C12,IF($G$1="cc23",'[Carlton Crest(1).xls]2002-2003'!C12,IF($G$1="cc34",'[Carlton Crest(1).xls]2003-2004'!C12,IF($G$1="cc45",'[Carlton Crest(1).xls]2004-2005'!C12,IF($G$1="mz23",'[Menzies.xls]2002-2003'!C12,IF($G$1="mz34",'[Menzies.xls]2003-2004'!C12,IF($G$1="mz45",'[Menzies.xls]2004-2005'!C12,IF($G$1="po23",'[PierOne.xls]2002-2003'!C12,IF$G$1="po34",'[PierOne.xls]2003-2004'!C12,IF$G$1="po45",'[PierOne.xls]2004-2005'!c12,IF($G$1="sl23",'[ShangriLa financial data.xls]2002-2003'!C12,IF($G$1="sl34",'[ShangriLa financial data.xls]2003-2004'!C12,IF($G$1="sl45",'[ShangriLa financial data.xls]2004-2005'!C12,IF($G$1="sw23",'[Swissotel Sydney.xls]2002-2003'!C12,IF($G$1="sw34",'[Swissotel Sydney.xls]2003-2004'!C12,IF($G$1="sw45",'[Swissotel Sydney.xls]2004-2005'!C12,))))))))))))))))))))))

Any solutions gratefully accepted.
Yogi Bear is offline   Reply With Quote
Old Aug 16th, 2005, 04:51 PM   #5
SteveO59L
 
Join Date: Apr 2004
Posts: 5,530
Default

I think that I would make a table listing the index and source.

av23.............'[Avillion.xls]2002-2003'!C12
av34.............'[Avillion.xls]2003-2004'!C12


etc

It would be a lot easier to maintain.
SteveO59L is offline   Reply With Quote
Old Aug 16th, 2005, 04:54 PM   #6
Yogi Bear
 
Join Date: Aug 2005
Location: Looking at the beach right now
Posts: 8
Default

Cheers Steve.

The problem is that c12 is only one cell in a table of N times 54 cells. So as you can understand, setting up a table like that would be rather ineffecient.

I don't know what to do!!!
Yogi Bear is offline   Reply With Quote
Old Aug 16th, 2005, 04:59 PM   #7
Yogi Bear
 
Join Date: Aug 2005
Location: Looking at the beach right now
Posts: 8
Default Sticky

it is a bit of a sticky question
Yogi Bear is offline   Reply With Quote
Old Aug 16th, 2005, 05:52 PM   #8
hatman
 
hatman's Avatar
 
Join Date: Apr 2005
Location: Palmer, MA
Posts: 2,454
Default

I think that Steve's solution has merit, it just needs a little tweak to get you there. In the table, rather than typing ='[Avillion.xls]2002-2003'!C12 (which gets you the value in that cell), use this instead: ''[Avillion.xls]2002-2003'!C12 (that is NOT a double quote, it is 2 single quotes, it gives you the text representing the address of the cell).

When you use the Vlookup function (let's assume in cell a3) you get a text string that represents the address of the upper left cell of the table from the correct file and sheet. Now you type the formula =OFFSET(INDIRECT($A$3),ROW(A1)-1,COLUMN(A1)-1) and copy it N times 54 to correspond with the size of the table on each referenced sheet. Now when the user selects a new set of criteria, the entire table changes to correspond with the contents of the proper table... I think that gets you there... I tested it on some local files of my own and it seems to work, if I understand your goal correctly.

EDIT: I fixed the formula above: as written it misses the first row and column, the -1 on row and column is important.
hatman is offline   Reply With Quote
Old Aug 17th, 2005, 01:06 PM   #9
Yogi Bear
 
Join Date: Aug 2005
Location: Looking at the beach right now
Posts: 8
Default

Hatman,

I am following up on your solution.

Will let you know how it goes.

Yogi
Yogi Bear is offline   Reply With Quote
Old Aug 17th, 2005, 02:30 PM   #10
Yogi Bear
 
Join Date: Aug 2005
Location: Looking at the beach right now
Posts: 8
Default Success

Hatman,

It took me a few minutes to decipher your solution. However it works a treat and solves my problem to a tee.

Thank you very much.

Yogi
Yogi Bear 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 +1. The time now is 05:27 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
All contents Copyright 1998-2010 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