#1   Report Post  
Elvin
 
Posts: n/a
Default multiple if

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.
  #2   Report Post  
paul
 
Posts: n/a
Default

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
--
paul
remove nospam for email addy!



"Elvin" wrote:

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.

  #3   Report Post  
Peo Sjoblom
 
Posts: n/a
Default

How can the value be <10 but 15 in your second option? Assuming there was a
typo and you mean 10 <15 that leaves 10 outside? Do you mean 1 <10, 2
=10 <15 and 3 =15 ?


If so you can use

=VLOOKUP(X-Y,{0,1;10,2;15,3},2)




Regards


Peo Sjoblom

(No private emails please)


"Elvin" wrote in message
...
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.


  #4   Report Post  
Elvin
 
Posts: n/a
Default

That was the trick. Thanks Paul!

"paul" wrote:

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
--
paul
remove nospam for email addy!



"Elvin" wrote:

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.

  #5   Report Post  
paul
 
Posts: n/a
Default

you might have to consider <= as well to include 10 and 15
--
paul
remove nospam for email addy!



"Elvin" wrote:

That was the trick. Thanks Paul!

"paul" wrote:

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
--
paul
remove nospam for email addy!



"Elvin" wrote:

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.



  #6   Report Post  
Joham Shason via OfficeKB.com
 
Posts: n/a
Default

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.

--
Message posted via http://www.officekb.com
  #7   Report Post  
Ken Wright
 
Posts: n/a
Default

Hi Poe <g

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------

"Peo Sjoblom" wrote in message
...
How can the value be <10 but 15 in your second option? Assuming there was

a
typo and you mean 10 <15 that leaves 10 outside? Do you mean 1 <10, 2
=10 <15 and 3 =15 ?


If so you can use

=VLOOKUP(X-Y,{0,1;10,2;15,3},2)




Regards


Peo Sjoblom

(No private emails please)


"Elvin" wrote in message
...
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.




  #8   Report Post  
Arvi Laanemets
 
Posts: n/a
Default

Hi

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


Arvi Laanemets


"Elvin" wrote in message
...
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.



  #9   Report Post  
Peo Sjoblom
 
Posts: n/a
Default

AKA "The Raven" <bg

--
Regards,

Peo Sjoblom

(No private emails please)


"Ken Wright" wrote in message
...
Hi Poe <g

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------

"Peo Sjoblom" wrote in message
...
How can the value be <10 but 15 in your second option? Assuming there
was

a
typo and you mean 10 <15 that leaves 10 outside? Do you mean 1 <10, 2
=10 <15 and 3 =15 ?


If so you can use

=VLOOKUP(X-Y,{0,1;10,2;15,3},2)




Regards


Peo Sjoblom

(No private emails please)


"Elvin" wrote in message
...
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.





  #10   Report Post  
RagDyeR
 
Posts: n/a
Default

Never more ... Never more!

"Peo Sjoblom" wrote in message
...
AKA "The Raven" <bg

--
Regards,

Peo Sjoblom

(No private emails please)


"Ken Wright" wrote in message
...
Hi Poe <g

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

--------------------------------------------------------------------------

--
It's easier to beg forgiveness than ask permission :-)
--------------------------------------------------------------------------

--

"Peo Sjoblom" wrote in message
...
How can the value be <10 but 15 in your second option? Assuming there
was

a
typo and you mean 10 <15 that leaves 10 outside? Do you mean 1 <10, 2
=10 <15 and 3 =15 ?


If so you can use

=VLOOKUP(X-Y,{0,1;10,2;15,3},2)




Regards


Peo Sjoblom

(No private emails please)


"Elvin" wrote in message
...
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.






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I show multiple worksheets on multiple screens? needville guy Excel Discussion (Misc queries) 0 April 3rd 05 04:15 AM
Can I get the mode, min, and max with multiple criteria? BobT Excel Discussion (Misc queries) 1 February 15th 05 03:20 AM
adding certain cells in multiple worksheets in multiple workbooks Stephen via OfficeKB.com Excel Worksheet Functions 1 February 4th 05 08:31 PM
XML / parent with multiple children and with multiple children Richard Excel Discussion (Misc queries) 0 January 5th 05 11:49 AM
multiple entries benny Excel Worksheet Functions 3 December 6th 04 01:38 AM


All times are GMT +1. The time now is 11:20 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"