If/Then statement

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need a formula that says "If the value in cell C8 is 1, then return $0. If
the value in cell C8 is 2, then return $105. If the value in cell C8 is 3,
then return $390. If the value in cell C8 is 4, then return $675.
 
Hi

=IF(C8=1,0,IF(C8=2,105,IF(C8=3,390,IF(C8=4,675,"something else"))))

change the "something else" to whatever you want if C8 doesn't fall between
1 & 4 inclusive

OR

=CHOOSE(C8,0,105,390,675)
note, this will return #value if C8 doesn't fall between 1 & 4 inclusive

Cheers
JulieD
 
One way:

=CHOOSE(C8,0,105,390,675)

If the value may be outside the range of 1-4:

=IF(AND(C8>=1,C8<=4),CHOOSE(C8,0,105,390,675),"")
 
Hi
better to use a lookup table for this . e.g. on a separate sheet
(called 'lookup') create the following:
A B
1 1 0
2 2 105
3 3 390
....

Now use the following formula
=VLOOKUP(C8,'lookup'!A1:B10,2,0)
 
One way

=VLOOKUP(C8,{1,0;2,105;3,390;4,675},2,0)

Regards,

Peo Sjoblom
 

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

Similar Threads


Back
Top