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 May 21st, 2002, 12:48 PM   #1
Sager
New Member
 
Join Date: May 2002
Location: Vancouver, BC
Posts: 2
Default

Here is a clarification on my origial posting. I made a couple of errors initially.

Column A represents the departure location
Column B represents the arrival location
Column C I want to represent the route.

A_____B_____C
Dep___Arr___Route
2007__2002
2003__2001
2001__2003
2005__2007
2005__2007
2003__2001
2001__2003
2007__2005

the route code array is below:
______________Destination
Origin
________2001____2002____2003____2005____2007
2001____________________2
2002____________________________________3
2003____2
2005____________________________________1
2007____________3_______________1


So going from 2007 to 2002 will be route 3. Similarily, going in reverse, from 2007 to 2002 will also be route 3.

Somehow, using the INDEX function, I should be able to enter a function to display either 1, 2 or 3 in Column C.


[ This Message was edited by: Sager on 2002-05-21 15:43 ]
Sager is offline   Reply With Quote
Old May 21st, 2002, 03:18 PM   #2
Al Chara
MrExcel MVP
 
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
Default

Can you define what the origin and destinations are for the acutal routes i.e. what routes 1, 2, and 3 are.
Al Chara is offline   Reply With Quote
Old May 21st, 2002, 03:25 PM   #3
Mark W.
MrExcel MVP
 
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
Default

How could Route 1 be "D" to "A" when "D" isn't listed as an origin?
Mark W. is offline   Reply With Quote
Old May 21st, 2002, 06:04 PM   #4
Al Chara
MrExcel MVP
 
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
Default

I have an answer for you but it is very dependent on how your sheet is setup.

I assumed the following data was A1:C9 where row 1 contains the headings Dep, Arr, Route.
Quote:
A_____B_____C
Dep___Arr___Route
2007__2002
2003__2001
2001__2003
2005__2007
2005__2007
2003__2001
2001__2003
2007__2005
Then I assumed the following matrix was in cells A11:F16 where A11 is blank.
Quote:
________2001____2002____2003____2005____2007
2001____________________2
2002____________________________________3
2003____2
2005____________________________________1
2007____________3_______________1
So, assuming the above setup, I put the following formula in cell C2 and copied it down to cell C9:

=OFFSET($A$11,MATCH(A2,$A$12:$A$16,0),MATCH(B2,$B$11:$F$11,0))

or

=INDEX($A$11:$F$16,MATCH(A2,$A$11:$A$16,0),MATCH(B2,$A$11:$F$11,0))

or using Yogi's suggestion with my ranges:

=VLOOKUP(A2,$A$11:$F$16,MATCH(B2,$A$11:$F$11),FALSE)

Tell me if there are any problems.

_________________
Hope this helps.
Kind regards, Al.

[ This Message was edited by: Al Chara on 2002-05-21 17:06 ]

[ This Message was edited by: Al Chara on 2002-05-21 17:44 ]
Al Chara is offline   Reply With Quote
Old May 21st, 2002, 06:23 PM   #5
Yogi Anand
MrExcel MVP
 
Join Date: Mar 2002
Location: Michigan USA
Posts: 11,452
Default

Quote:
On 2002-05-21 11:48, Sager wrote:
Here is a clarification on my origial posting. I made a couple of errors initially.

Column A represents the departure location
Column B represents the arrival location
Column C I want to represent the route.

A_____B_____C
Dep___Arr___Route
2007__2002
2003__2001
2001__2003
2005__2007
2005__2007
2003__2001
2001__2003
2007__2005

the route code array is below:
______________Destination
Origin
________2001____2002____2003____2005____2007
2001____________________2
2002____________________________________3
2003____2
2005____________________________________1
2007____________3_______________1


So going from 2007 to 2002 will be route 3. Similarily, going in reverse, from 2007 to 2002 will also be route 3.

Somehow, using the INDEX function, I should be able to enter a function to display either 1, 2 or 3 in Column C.


[ This Message was edited by: Sager on 2002-05-21 15:43 ]
If your routes are set as a table in range A20:F25, and your start and destination are in cells A2 and B2, then the following formula should do

=VLOOKUP(A2,$A$20:$F$25,MATCH(B2,$A$20:$F$20,0),0)

Regards!


_________________
Yogi Anand

Edit: Deleted inactive website from hardcoded signature

[ This Message was edited by: Yogi Anand on 2003-01-19 13:02 ]
Yogi Anand is offline   Reply With Quote
Old May 21st, 2002, 06:42 PM   #6
Yogi Anand
MrExcel MVP
 
Join Date: Mar 2002
Location: Michigan USA
Posts: 11,452
Default

Reproduced below is a simulation of the worksheet with the VLOOKUP solution:

Microsoft Excel - y020521.xls
A12=
ABCDEF
1DepArrRoute
220072002:alert('=VLOOKUP(A2,$A$20:$F$25,MATCH(B2,$A$20:$F$20,0),0)')>0
320032001:alert('=VLOOKUP(A3,$A$20:$F$25,MATCH(B3,$A$20:$F$20,0),0)')>2
420012003:alert('=VLOOKUP(A4,$A$20:$F$25,MATCH(B4,$A$20:$F$20,0),0)')>2
520052007:alert('=VLOOKUP(A5,$A$20:$F$25,MATCH(B5,$A$20:$F$20,0),0)')>1
620052007:alert('=VLOOKUP(A6,$A$20:$F$25,MATCH(B6,$A$20:$F$20,0),0)')>1
720032001:alert('=VLOOKUP(A7,$A$20:$F$25,MATCH(B7,$A$20:$F$20,0),0)')>2
820012003:alert('=VLOOKUP(A8,$A$20:$F$25,MATCH(B8,$A$20:$F$20,0),0)')>2
920072005:alert('=VLOOKUP(A9,$A$20:$F$25,MATCH(B9,$A$20:$F$20,0),0)')>1
10
11
12
13
14
15 :alert('=MATCH(B2,A20:F20,0)')>3
16
17
18
19
20 20012002200320052007
212001 2
222002 3
2320032
242005 1
2520073 1
Sheet3

Click on a hyperlinked cell to view the underlying formula
__________________
Regards!

Yogi Anand, D.Eng, P.E.
Energy Efficient Building Network LLC
www.energyefficientbuild.com
Yogi Anand is offline   Reply With Quote
Old May 21st, 2002, 06:50 PM   #7
Al Chara
MrExcel MVP
 
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
Default

Yogi, you have your route matrix setup wrong, but your formula will work if it is fixed.

[ This Message was edited by: Al Chara on 2002-05-21 17:51 ]
Al Chara is offline   Reply With Quote
Old May 21st, 2002, 06:59 PM   #8
Yogi Anand
MrExcel MVP
 
Join Date: Mar 2002
Location: Michigan USA
Posts: 11,452
Default

Hi Al:
My route matrix is in cells A20:F25 -- Ya! I seeit now, it is in the last line -- it should have been route 3 from 2007 to 2002 and not 2001.

Thanks for keeping me honest!
Yogi Anand is offline   Reply With Quote
Old May 22nd, 2002, 11:27 AM   #9
Sager
New Member
 
Join Date: May 2002
Location: Vancouver, BC
Posts: 2
Default

Awesome!
Amazing responsiveness.
Thanks a million!
Till next time (and there will be a next time, assured),

Sager
Sager 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 01:31 AM.


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