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 22nd, 2002, 07:41 PM   #1
btahu
New Member
 
Join Date: May 2002
Location: Sydney - Australia
Posts: 7
Default

I have a column of no's inside a spreadsheet which designate a class of products within a group. I have tried to use the IF but it only works for the 1st argument and not the 2nd 3rd etc. What am I doing wrong and is there a more efficient way of doing this simple chore.
A B C
1 2012
2 2012
3 2013
4 3019
5 6014
6 7015

I am trying =IF(B1={2012,2013,3019,6014,7015},"Bats","Balls","Gloves","Wheels","Pumps")

Thanks in advance,

Bill Tahu
btahu is offline   Reply With Quote
Old May 22nd, 2002, 08:07 PM   #2
Juan Pablo González
MrExcel MVP
 
Join Date: Feb 2002
Location: Bogota, Colombia
Posts: 11,927
Default

I think you're looking for:

=VLOOKUP(B1,{2012,"Bats";2013,"Balls";3019,"Gloves";6014,"Wheels";7015,"Pumps"},2,0)
__________________
Regards,

Juan Pablo González
http://www.juanpg.com
Juan Pablo González is offline   Reply With Quote
Old May 22nd, 2002, 08:13 PM   #3
stevebausch
Board Regular
 
Join Date: May 2002
Posts: 809
Default

IF will return one value, or another, it is not expected to return multiple values.

Were this in VBA, I would suggest Select Case.

What you are trying to do is:

IF the value is ______, then _______
OR
IF the value is ______, then _______
OR
IF the value is ______, then _______

You get the idea.

You will need to construct a number of IF statements, and string them together.

In VBA, the best construct would be Select Case.

I stay away from complex cell formula, and this would be a complex cell formula, if it can be done at all.

I am not the person to help you on this, since my gut feeling is "it can't be done".
stevebausch is offline   Reply With Quote
Old May 22nd, 2002, 10:09 PM   #4
btahu
New Member
 
Join Date: May 2002
Location: Sydney - Australia
Posts: 7
Default

Hi Juan and thanks,

Can I use multiples
i.e Vlookup(B1, {2001,2003,3004,2012,"Bats" and what does the ,2,0, signify at the end of the Vlookup. Is there a limitation to how many records I can have in the Vlookup.

I am not a VBA exponent but is that a suitable solution and relatively simple?

Regards

Bill T
btahu is offline   Reply With Quote
Old May 22nd, 2002, 11:38 PM   #5
Juan Pablo González
MrExcel MVP
 
Join Date: Feb 2002
Location: Bogota, Colombia
Posts: 11,927
Default

Check this example.

In the first one, there's no EXACT match, that's why using FALSE (or 0) returns N/A, in the second one, there is an EXACT match.

Microsoft Excel - Book1___Running: xl2002 XP : OS = Windows (32-bit) 4.90
(F)ile (E)dit (V)iew (I)nsert (O)ptions (T)ools (D)ata (W)indow (H)elp
A1=

A
B
C
D
E
1

Column1Column2Column3Column4
2

10150900
3

202601000
4

303701100
5

404801200
6





7





8

Looked Value31

9





10


TRUEFALSE
11
Which column ?1:alert('=VLOOKUP($C$8,$B$2:$E$5,$B11,C$10)')>30:alert('=VLOOKUP($C$8,$B$2:$E$5,$B11,D$10)')>#N/A
12

2:alert('=VLOOKUP($C$8,$B$2:$E$5,$B12,C$10)')>3:alert('=VLOOKUP($C$8,$B$2:$E$5,$B12,D$10)')>#N/A
13

3:alert('=VLOOKUP($C$8,$B$2:$E$5,$B13,C$10)')>70:alert('=VLOOKUP($C$8,$B$2:$E$5,$B13,D$10)')>#N/A
14

4:alert('=VLOOKUP($C$8,$B$2:$E$5,$B14,C$10)')>1100:alert('=VLOOKUP($C$8,$B$2:$E$5,$B14,D$10)')>#N/A
15





16

Looked Value10

17





18


TRUEFALSE
19
Which column ?1:alert('=VLOOKUP($C$16,$B$2:$E$5,$B19,C$10)')>10:alert('=VLOOKUP($C$16,$B$2:$E$5,$B19,D$10)')>10
20

2:alert('=VLOOKUP($C$16,$B$2:$E$5,$B20,C$10)')>1:alert('=VLOOKUP($C$16,$B$2:$E$5,$B20,D$10)')>1
21

3:alert('=VLOOKUP($C$16,$B$2:$E$5,$B21,C$10)')>50:alert('=VLOOKUP($C$16,$B$2:$E$5,$B21,D$10)')>50
22

4:alert('=VLOOKUP($C$16,$B$2:$E$5,$B22,C$10)')>900:alert('=VLOOKUP($C$16,$B$2:$E$5,$B22,D$10)')>900
Sheet1

To see the formula in the cells just click on the cells hyperlink

The above image was automatically generated by [HtmlMaker V1.28]
If you want FREE SOFT, click here and Colo will email the file to you
This code was graciously allowed to be modified: by Ivan F Moala All credit to Colo

__________________
Regards,

Juan Pablo González
http://www.juanpg.com
Juan Pablo González is offline   Reply With Quote
Old May 23rd, 2002, 12:06 AM   #6
btahu
New Member
 
Join Date: May 2002
Location: Sydney - Australia
Posts: 7
Default

HI Juan,

I have the following entered in C1 it finds the 2012 and correctly enters Bats, however the next line C2, which has 2013 is #N/A.

=VLOOKUP(B1,{2012,"Bats",2013,"Bats"},2,0)

What am I doing wrong? I have looked at the formating, all appears to be normal however I can not get rid of the #N/A

Regards,

Bill T
btahu is offline   Reply With Quote
Old May 23rd, 2002, 12:13 AM   #7
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
Default

Quote:
On 2002-05-22 23:06, btahu wrote:
HI Juan,

I have the following entered in C1 it finds the 2012 and correctly enters Bats, however the next line C2, which has 2013 is #N/A.

=VLOOKUP(B1,{2012,"Bats",2013,"Bats"},2,0)

What am I doing wrong? I have looked at the formating, all appears to be normal however I can not get rid of the #N/A

Regards,

Bill T
You need to use ; to separate pairs of values:

=VLOOKUP(B1,{2012,"Bats";2013,"Bats"},2,0)
Aladin Akyurek is offline   Reply With Quote
Old May 23rd, 2002, 01:37 AM   #8
btahu
New Member
 
Join Date: May 2002
Location: Sydney - Australia
Posts: 7
Default

HI All,

Thanks for the help works fine - 5500 line items, 51 categories, and 10 groups. Is a large Vlookup table, so VBA may be needed for the future?

Regards & Thanks


Bill T
btahu 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:55 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