IF statements

U

user21

I have a Category, Color (Red, Blue, Green and Black) and each color
corresponds to a certain figure (e.g. Red=10 Blue=20...and so on). What
i did was create If statements within each other, like
=IF(Color="Red",10,IF(Color="Blue"=20,IF...) But it doesnt seem to
work. Ive used this before but it doenst work this time. Do i have to
define the Color category to include all the colors i want? And if so,
how do i go abt doing it? Thanks
 
J

JMay

You could create a table of your colors with values and then use the
Vlookup() function to refer to the appropriate color code; Also the
Choose() function is another possibility. I could send you a few examples
(in a file) upon request.
 
A

Andy B

user21

Assuming the Color is in C2 use this in D2:

=IF(C2="Red",10,IF(C2="Blue",20,IF(C2="Green",30,IF(C2="Black",40))))

Andy.
 
U

user21

Thanks Andy, that solved the problem. Wasnt quite what I wanted, but it
works! Thanks again. But, If i use Vlookup to define the color table,
would that work?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top