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 27th, 2002, 01:25 PM   #1
icka
New Member
 
Join Date: Mar 2002
Posts: 5
Default

In cell C1, enter in a number from 1-10, then in cell C2, depending on the number in C1, a dollar amount will appear.

If C1 = 10, then C2 is 262.50
If C1 = 9, then C2 is 259.88 etc...

10 - 262.50
9 - 259.88
8 - 257.25
7 - 254.63
6 - 252.00
5 - 249.38
4 - 246.75
3 - 244.13
2 - 241.50
1 - 238.88

Of course, I can set up the formula up to 7 IF's. What is the best way to go beyond 7?

One column is where 1-10 would be entered, and the 2nd column is where I want 238.88-262.50 to show up. The 2nd column would have the formula.

This is what I have..
=IF(C32=1,238.88,IF(C32=2,241.5,IF(C32=3,244.13,IF(C32=4,246.75,IF(C32=5,249.39,IF(C32=6,252,IF(C32=7,254.63,0)))))))



[ This Message was edited by: icka on 2002-03-27 13:04 ]
icka is offline   Reply With Quote
Old Mar 27th, 2002, 01:34 PM   #2
BabyTiger
Board Regular
 
Join Date: Mar 2002
Location: Wellington
Posts: 104
Default

Hi icka,

My suggest is, instead using IF statements, use a vlookup function or something similar.

For example, have your 1 to 10 table entered somewhere else. , like Column K1 to K10 is 1 to 10, and L1 to L10 is the amounts.

Then in cell C1, C2 onwards, enter whatever number you wish (between 1 and 10 of course), then in column D (eg.D1), enter the following vlookup function:

=vlookup(C1,$K$1:$L$10,2,FALSE)

Basically, it is looking up the value from table K1:L10 based on the reference in C1.

HTH
BabyTiger is offline   Reply With Quote
Old Mar 27th, 2002, 01:38 PM   #3
wi_guy
Board Regular
 
Join Date: Mar 2002
Posts: 50
Default

If I read it right, what u want is a lookup table.

In 2 columns, anywhere in your worksheet, you would have:
1 - 238.88
2 - 241.50
3 - 244.13
4 - 246.75
5 - 249.38
6 - 252.00
7 - 254.63
8 - 257.25
9 - 259.88
10 - 262.50


If they were in cells a1:b10, and the number that you want to enter is in say D1, then the formula would be =vlookup(d1,$a1.$b10,1)
wi_guy is offline   Reply With Quote
Old Mar 27th, 2002, 01:38 PM   #4
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
Default

Quote:
On 2002-03-27 12:25, icka wrote:
In cell C1, enter in a number from 1-10, then in cell C2, depending on the number in C1, a dollar amount will appear.

If C1 = 10, then C2 is 262.50
If C1 = 9, then C2 is 259.88 etc...

10 - 262.50
9 - 259.88
8 - 257.25
7 - 254.63
6 - 252.00
5 - 249.38
4 - 246.75
3 - 244.13
2 - 241.50
1 - 238.88

Of course, I can set up the formula up to 7 IF's. What is the best way to go beyond 7?

This is what I have..
=IF(C32=1,238.88,IF(C32=2,241.5,IF(C32=3,244.13,IF(C32=4,246.75,IF(C32=5,249.39,IF(C32=6,252,IF(C32=7,254.63,0)))))))

[ This Message was edited by: icka on 2002-03-27 12:26 ]
Adding to Tiger's observation:

=INDEX({238.88,241.5,244.13,246.75,249.38,252,254.63,257.25,259.88,262.5},C32)

Aladin
Aladin Akyurek is offline   Reply With Quote
Old Mar 27th, 2002, 01:42 PM   #5
wi_guy
Board Regular
 
Join Date: Mar 2002
Posts: 50
Default

Opps, I had a typo.....offset is 2, not 1 and I forgot the ,false also.........sheeesh you guys are quick.
wi_guy is offline   Reply With Quote
Old Mar 27th, 2002, 01:42 PM   #6
bobmc
Board Regular
 
Join Date: Mar 2002
Posts: 142
Default

OK, this is my first try at offering advice on this board, but here goes...

I'd use a VLOOKUP command. Build a table much like you have above with the "1 through 10" and their amounts. Let's say you build this table in cells A1 through B10.

Then, have the user enter any number 1 through 10 in cell C1. In cell C2, the formula would be as follows...

VLOOKUP(C1,A1:B10,2,FALSE)

Give this a try. I would also defer to one of the more experienced board members on this.

bobmc
bobmc is offline   Reply With Quote
Old Mar 27th, 2002, 02:02 PM   #7
icka
New Member
 
Join Date: Mar 2002
Posts: 5
Default

Quote:
On 2002-03-27 12:38, wi_guy wrote:
If I read it right, what u want is a lookup table.

In 2 columns, anywhere in your worksheet, you would have:
1 - 238.88
2 - 241.50
3 - 244.13
4 - 246.75
5 - 249.38
6 - 252.00
7 - 254.63
8 - 257.25
9 - 259.88
10 - 262.50


If they were in cells a1:b10, and the number that you want to enter is in say D1, then the formula would be =vlookup(d1,$a1.$b10,1)
Actually, one column is where 1-10 would be entered, and the 2nd column is where I want 238.88-262.50 to show up. The 2nd column would have the formula.





icka is offline   Reply With Quote
Old Mar 27th, 2002, 02:06 PM   #8
wi_guy
Board Regular
 
Join Date: Mar 2002
Posts: 50
Default

That's correct...the vlookup table where the data resides would be off to the side somewhere or even on another worksheet, and then you would type 1-10 in column A, and the formula in Column B....and it will lookup the information in Column A and bring back the correct $ figure in Column B.....if this isn't what you were after, please redifine the problem.
wi_guy is offline   Reply With Quote
Old Mar 28th, 2002, 01:21 PM   #9
icka
New Member
 
Join Date: Mar 2002
Posts: 5
Default

Thanks for the help!!
It worked!
icka is offline   Reply With Quote
Old Mar 28th, 2002, 03:29 PM   #10
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
Default

Actually, one column is where 1-10 would be entered, and the 2nd column is where I want 238.88-262.50 to show up. The 2nd column would have the formula.

The INDEX formula also fits what you want:

If A1 has a target number,

in B1 enter:

=INDEX({238.88,241.5,244.13,246.75,249.38,252,254.63,257.25,259.88,262.5},A1)

INDEX uses the value in A1 to determine which number to retrieve from the constant array:

{238.88,241.5,244.13,246.75,249.38,252,254.63,257.25,259.88,262.5}

in case you missed it.

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 01:21 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