"IF" involving intervals

wvan

New Member
Joined
Aug 18, 2002
Messages
13
I run Excel on native MS Office 2002 XP.

I am trying to define 3 conditions for analysing my data, one of which includes an interval. These are:

If A1 > 3 then A2 = 1
If A1 < 3 and > 0 then A2 = N
If A1 < 0 then A2 = 2

I am frustrated in my attempts to use MS Help because it is formatted to accept only 2 outcomes (true or false)

Thank you for you help
 
On 2002-08-21 16:02, Juan Pablo G. wrote:
Aladin, just curious, why the =0+ at the beggining ?

=0+((A1<=0)-(A1>=3))

shouldn't the "-" take care of the coercing ?

Yes, it will. I had actually another part in between. When it occurred to me to remove that, I forgot to remove 0+ together with it.

So lets make it:

=((A1<=0)-(A1>=3))

How about the logic, Juan?


Aladin
 
Upvote 0

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
On 2002-08-21 14:54, Jay Petrulis wrote:
Hi,

You need to answer Mark's question -- what happens at 0 and 3?

If you want the following
x -> (oo,3) = 1
x -> [3,0) = N
x -> [0,-oo) = 2

try,
=C

Change the > to >= if you want to test the critical points differently

----

Probably because the sintax is different on Excel XP 2002 I get an error message. I am then suggested a general formula which is

If(Logical_Test;[value_if_true];[value_if_fase])

which is placed in yellow under the formula in copied.

In that general formula, the [value_if_true] part is highlighted as well as the specific formula from the ";" onwards namely

1,IF(A1>0;"N";2))

obviously, my version of Excel assumes that the above expression is the [value_if_true] part of the formula. I tried changing around the ";" for "," but to no avail.

On the other hand,

=0+((A1<=0)-(A1>=3)) works but I would love to express it using IF.

Thank you
 
Upvote 0
...

On the other hand,

=0+((A1<=0)-(A1>=3)) works but I would love to express it using IF.

You can omit 0+, so it's:

=(A1<=0)-(A1>=3)

which is re-expressible in terms of IF as:

=IF(A1<=0,1,IF(A1>=3,-1,0))

or

=IF(A1<=0,1,IF(A1>=3,-1,"N"))

Aladin
 
Upvote 0

Forum statistics

Threads
1,215,700
Messages
6,126,287
Members
449,308
Latest member
VerifiedBleachersAttendee

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top