multiple if

E

Elvin

I need to create a formula that outputs a 1, 2, or 3 based on the result of:

If the value of x-y <10 then cell B3 = 1, If the value of x-y<10 but> 15
then cell B3 = 2, If x-y<15 then cell B3 = 3.

Can I do this with formulae or do I need to go to VBA, if I need to go to
VBA how is this calculated.
 
P

paul

in cell B3 =if(x-y<10,1,if(x-y<15,2,3)).I have assumed your middle statement
is between 10 and 15 and your last statement is greater than 15.I cant make
sense otherwise
 
E

Elvin

That was the trick. Thanks Paul!

paul said:
in cell B3 =if(x-y<10,1,if(x-y<15,2,3)).I have assumed your middle statement
is between 10 and 15 and your last statement is greater than 15.I cant make
sense otherwise
 
J

Joham Shason via OfficeKB.com

Hi Poe, Elvin and Paul,
That was a good one Poe. I think Elvin has not described the problem
properly and everyone has the solution though.

Condition 1 Elvin stated: If the value of x-y <10 then cell B3=1. FINE

Condition 2 Elvin stated: If the value of x-y<10 but> 15
then cell B3 = 2. Now this is contradictory to condition 1. In con 1 <10
B3=1. Now here in CON 2 he again want <10 B3 =2.

Condition 3 Elvin stated: If value x-y<15 B3=3. Contadictory to condition 1
and part of condition 2.

I am sorry if I have misunderstood anyone here.

The alternate formula for Poe's formula=VLOOKUP(X-Y,{0,1;10,2;15,3},2) is
=IF(x-y<10,1,IF(AND(x-y>=10,x-y<15),2,3)).

Poe thanks I learnt something from your formula. Elvin I request you to
consider your condition.
 
A

Arvi Laanemets

Hi

Another solution
=MATCH(B3,{0;10;15},1)
(I myself can't use Peo's solution because my regional settings.)


Arvi Laanemets
 
R

RagDyeR

Never more ... Never more!

AKA "The Raven" <bg>

--
Regards,

Peo Sjoblom

(No private emails please)
 
Top