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 Mar 6th, 2002, 05:30 AM   #1
JRyan
New Member
 
Join Date: Mar 2002
Posts: 6
Default

I have a set of six different dollar amounts. I want to write a formula (argument) so that if I pit a number (1-6) in a cell it will put the value (Dollar amount) I want assigned to that number in the cell next to it? Is that possible.


JRyan is offline   Reply With Quote
Old Mar 6th, 2002, 05:42 AM   #2
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
Default

Quote:
On 2002-03-06 04:30, JRyan wrote:
I have a set of six different dollar amounts. I want to write a formula (argument) so that if I pit a number (1-6) in a cell it will put the value (Dollar amount) I want assigned to that number in the cell next to it? Is that possible.
How about:

=VLOOKUP(A1,{1,dol1;2,dol2;3,dol3;4,dol4;5,dol5;6,dol6},2,0)

where dol1 is the dollar amount associated with 1, dol2 the dollar amount associated with 2, etc.?

dol1, dol2,... are numbers and must be entered as constants between the braces.

If this is not what you want, try to be more specific.




[ This Message was edited by: Aladin Akyurek on 2002-03-06 06:52 ]
Aladin Akyurek is offline   Reply With Quote
Old Mar 6th, 2002, 05:44 AM   #3
dk
MrExcel MVP
 
Join Date: Feb 2002
Location: Sydney, Australia
Posts: 2,908
Default

Looks like you could use VLOOKUP. Here's a quick example:-

Say in range A1:A6 you have the numbers 1 to 6 and in range B1:B6 you have your dollar amounts. In any cell (say C1) type a number between 1 and 6 and in another cell (say D1) type this:-

=VLOOKUP(C1,A1:B6,2,FALSE)

VLOOKUP can be confusing if you've never used it before. Basically it's saying take the value in C1, go and look in the first column in the range A1:B6 until you find a value which matches that in C1, go to column 2 (i.e. B1:B6) and return that value (the dollar amount). The FALSE part is required if the list isn't sorted. If it is, then you can omit it.

HTH,
D
dk is offline   Reply With Quote
Old Mar 6th, 2002, 06:23 AM   #4
JRyan
New Member
 
Join Date: Mar 2002
Posts: 6
Default

I'll try to be more specific. In cell C5 I want to be able to enter a number.(1,2,3,4,5, or 6). I want the dollar amount for that number to appear in C7.
The value for 1 is $32.50
The value for 2 is $22.50
The value for 3 is $37.50
The value for 4 is $25.00
The value for 5 is $45.00
The value for 6 is $32.50

Thanks
JRyan
JRyan is offline   Reply With Quote
Old Mar 6th, 2002, 06:58 AM   #5
JRyan
New Member
 
Join Date: Mar 2002
Posts: 6
Default

Quote:
On 2002-03-06 04:44, dk wrote:
Looks like you could use VLOOKUP. Here's a quick example:-

Say in range A1:A6 you have the numbers 1 to 6 and in range B1:B6 you have your dollar amounts. In any cell (say C1) type a number between 1 and 6 and in another cell (say D1) type this:-

=VLOOKUP(C1,A1:B6,2,FALSE)

VLOOKUP can be confusing if you've never used it before. Basically it's saying take the value in C1, go and look in the first column in the range A1:B6 until you find a value which matches that in C1, go to column 2 (i.e. B1:B6) and return that value (the dollar amount). The FALSE part is required if the list isn't sorted. If it is, then you can omit it.

HTH,
D
JRyan is offline   Reply With Quote
Old Mar 6th, 2002, 07:06 AM   #6
Guest
 
Posts: n/a
Default

I understand this one and it does exactly what I want it to. If I could just push it one step further. If I don't put a number (1 - 6)in cell C1, can I get D1 to show nothing. ( Now it shows #N/A if I don not enter in C1 )

Thanks so much to the both of you for your fast response and help. LIFE IS GOOD AGAIN!!
JRyan

Quote:
On 2002-03-06 04:44, dk wrote:
Looks like you could use VLOOKUP. Here's a quick example:-

Say in range A1:A6 you have the numbers 1 to 6 and in range B1:B6 you have your dollar amounts. In any cell (say C1) type a number between 1 and 6 and in another cell (say D1) type this:-

=VLOOKUP(C1,A1:B6,2,FALSE)

VLOOKUP can be confusing if you've never used it before. Basically it's saying take the value in C1, go and look in the first column in the range A1:B6 until you find a value which matches that in C1, go to column 2 (i.e. B1:B6) and return that value (the dollar amount). The FALSE part is required if the list isn't sorted. If it is, then you can omit it.

HTH,
D
  Reply With Quote
Old Mar 6th, 2002, 07:18 AM   #7
dk
MrExcel MVP
 
Join Date: Feb 2002
Location: Sydney, Australia
Posts: 2,908
Default

Try this:-

=IF(ISNA(VLOOKUP(C1,A1:B6,2,FALSE)),"",VLOOKUP(C1,A1:B6,2,FALSE))

HTH,
D
dk is offline   Reply With Quote
Old Mar 6th, 2002, 07:29 AM   #8
JRyan
New Member
 
Join Date: Mar 2002
Posts: 6
Default

BINGO!!!!!
I can't thank you guys enough!
I've talked to so many people who I thought were wizards in the program and they had no idea even if it could be done....
YOU GUY'S ARE GREAT!!!
I won't loose the address for this board.
JRyan

Quote:
On 2002-03-06 06:18, dk wrote:
Try this:-

=IF(ISNA(VLOOKUP(C1,A1:B6,2,FALSE)),"",VLOOKUP(C1,A1:B6,2,FALSE))

HTH,
D
JRyan is offline   Reply With Quote
Old Mar 6th, 2002, 07:49 AM   #9
Andy Gee
New Member
 
Join Date: Feb 2002
Posts: 48
Default

Or try this

=OFFSET(A1,B2,0)

When A2:A7 contain the dollar amounts and B2 is the cell you enter the number into.
Andy Gee is offline   Reply With Quote
Old Mar 6th, 2002, 07:51 AM   #10
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
Default

Quote:
On 2002-03-06 05:23, JRyan wrote:
I'll try to be more specific. In cell C5 I want to be able to enter a number.(1,2,3,4,5, or 6). I want the dollar amount for that number to appear in C7.
The value for 1 is $32.50
The value for 2 is $22.50
The value for 3 is $37.50
The value for 4 is $25.00
The value for 5 is $45.00
The value for 6 is $32.50

Thanks
JRyan
=VLOOKUP(A1,{1,32.5;2,22.5;3,37.5;4,25;5,45;6,32.5},2,0)

If you want some control over what can be inputted in A1, use:

=IF(AND(ISNUMBER(A1),A1>=1,A1<=6,INT(A1 =A1)),VLOOKUP(A1,{1,32.5;2,22.5;3,37.5;4,25;5,45;6,32.5},2,0),0)

Format the cell of this formula as number with 3 decimals, if so desired.

Aladin

Aladin Akyurek 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 09:13 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