IF function for < > range

N

Nikki

Hi,

I have 5 columns,
A = random number between 1-100
B = IF A< 75 , yes = 1, no = 0
C = If A> 75 AND A< 78, yes =1, no = 0


Colums B and E work fine, but I can't figure out how to
define C and D as < and >.
If seems to only be able to do as one or the other.

Thank you so very much,
policy analyst of the future
 
B

Bob Phillips

Nikki,

In C1

=IF(AND(A1>75,A1<78),1,0)

You don't state the values for D but you should be able to figure it.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
G

Guest

PERFECT!!

Thanks so much.

I promise to spend your tax dollars more effecintly when I
get out of school and into government.

(-:
 
B

Bob Phillips

Mine are tax pounds!

Bob

PERFECT!!

Thanks so much.

I promise to spend your tax dollars more effecintly when I
get out of school and into government.

(-:
 
J

Jim McAward

Folks,
I have a similar problem to solve, except I need a logical test to
return one of three possible solutions.

I'll describe it in text, since I can't get the code straight!! ;-)

I am looking at the value in cell A1. If A7 is between 0 and 7, then I
want to return "7". If the value is between 7 and 12, I want to return
"12". If the value is between 12 and 17, I want to return "17".

Using the logical test and the helpful solution in this thread, I can
accomplish two-thirds of this:

=IF(AND(A1<7,A1<12),7,12)

However, I can't test for the range above 12 and under 17!

Any help would be much appreciated!!
Best regards/Cheers,
Jim McAward
(designing a battery selection tool for batteries that come in three
sizes)
 
B

Bob Phillips

Jim,

This test AND(A1<7,A1<12) has redundancy, because if A1<7, then it has to be
<12 as well, so there is only on test.

I think this does what you want

=IF(A1<=7,7,IF(A1<=12,12,IF(A1<=17,17,"???")))

you don't say what to do if A1 > 17, so I used "????"

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
G

Gord Dibben

Jim

"between" is ambiguous. Do you want 7 and less, 12 and greater, less than 17?

Here's my attempt.

=IF(A1<=7,7,IF(A1>12,17,12))

Note: you don't say what you would want returned if A1 is >17 so I have not
considered that.

Gord Dibben XL2002
 

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