need some beginner help

E

Eric

I have 3 cells A2, B2 and C2... A2 and B2 display results formula results
from other cells and I am trying to find a formula for C2 that does the
following: If A2 is between .84 & .95 and B2 is between .012 & .008 then C2
displays 'yes' otherwise it is blank. I've tried a few excel help sites but
I can't seem to get it to work.

Thanks!
 
S

Stan Brown

I have 3 cells A2, B2 and C2... A2 and B2 display results formula results
from other cells and I am trying to find a formula for C2 that does the
following: If A2 is between .84 & .95 and B2 is between .012 & .008 then C2
displays 'yes' otherwise it is blank. I've tried a few excel help sites but
I can't seem to get it to work.

"and" is a function, not an operator. (Your B2 range is backward
too, which might be part of your problem.)

=IF( AND(A2>=.84, A2<=.95, B2>=.008, B2<=.012), "yes", "")
 
C

Clif McIrvin

Eric said:
I have 3 cells A2, B2 and C2... A2 and B2 display results formula
results from other cells and I am trying to find a formula for C2 that
does the following: If A2 is between .84 & .95 and B2 is between .012 &
.008 then C2 displays 'yes' otherwise it is blank. I've tried a few
excel help sites but I can't seem to get it to work.


When I need a complex formula, I often build it one piece at a time,
using as many cells as necessary until I have the logic all correct ...
then I use copy / paste to combine the pieces into a single formula.

I have also found Evaluate Formula to be a useful tool.

Try (untested):

C2: = IF( AND( AND( A2>0.84,A2<0.95), AND(B2>0.012,B2<0.008)), "Yes",
"")

Note that I understand "between" to mean "not equal to either". If
needed, change the >, < operators to >=, <=.
 
J

joeu2004

I have 3 cells A2, B2 and C2... A2 and B2 display results
formula results from other cells and I am trying to find
a formula for C2 that does the following: If A2 is between
.84 & .95 and B2 is between .012 & .008 then C2 displays
'yes' otherwise it is blank.

There are two separate issues implied in your question.

First, how to express the condition? Ostensibly, that might be done
as follows [1]:

=IF(AND(0.84<=A2,A2<=0.95,0.008<=B2,B2<=0.012),"yes","")

Second, there is an issue with precision. It would be more reliable
to write [2]:

=IF(AND(0.84<=ROUND(A2,2),ROUND(A2,2)<=0.95,
0.008<=ROUND(B2,3),ROUND(B2,3)<=0.012),"yes","")

Actually, it would be preferable to explicitly round the formulas in
A2 and B2 accordingly, if you always require their results to be
accurate to 2 and 3 decimal places respectively. Then you can use the
first formula with impunity.

-----
Endnotes

[1] There is no difference between 0.84<=A2 and A2>=0.84. I like to
write two-ended limit conditions as AND(0.84<=A2,A2<=0.95) because it
is similar to the mathematical expression 0.84<=A2<=0.95.

[2] Explicit rounding is usually needed for comparisons, at least,
because Excel, like most applications, usually uses binary floating-
point to store numbers and for computations. Consequently, most non-
integers (and most integers larger than 2^53) cannot be represented
exactly. This creates anomalies like IF(10.1-10=0.1,TRUE) returns
FALSE(!).

Also, formatting alone changes only the __appearance__ of a cell
value. Normally, it does not alter the __actual__ cell value. For
example, if A2 is formatted as Number with 2 decimal places, what
__appears__ to be 0.84 might be any value between 0.835-4*2^-53 and
0.845-5*2^-53. Note that any value less than A2-4*2^-53 will fail the
test.
 
E

Eric

I have 3 cells A2, B2 and C2... A2 and B2 display results
formula results from other cells and I am trying to find
a formula for C2 that does the following: If A2 is between
.84 & .95 and B2 is between .012 & .008 then C2 displays
'yes' otherwise it is blank.

There are two separate issues implied in your question.

First, how to express the condition? Ostensibly, that might be done
as follows [1]:

=IF(AND(0.84<=A2,A2<=0.95,0.008<=B2,B2<=0.012),"yes","")

Unfortunately I do need it from two to three decimal places, but this works
perfectly... thanks!!

And thanks to everyone else that helped!
 
J

joeu2004

=IF(AND(0.84<=A2,A2<=0.95,0.008<=B2,B2<=0.012),"yes","")

Unfortunately I do need it from two to three decimal places,
but this works perfectly... thanks!!

Just to be clear, my suggested use of ROUND did __not__ oppose your
need for "two or three decimal places". In fact, it supported it.

The point is: the computed value in A2 might __look__ like it is
between 0.84 and 0.95, but it might not be for various reasons.

If you want to ensure that the computed value in A2 is between 0.84
and 0.95 to two decimal places, it would be prudent to use ROUND as I
demonstrated previously.

Similarly for B2. But note that you can round B2 to 3 decimal places,
but round A2 to 2 decimal places, as you indicated in your
comparisons. They do not need to have the same number of decimal
places.

The only time you should not use ROUND is when you do not know how
many decimal places to use.

And of course you do not need to use ROUND as long as you can "get
away without it". There are many times when we do not care if the
displayed value is not exactly the same as the actual value.
 
E

Eric

=IF(AND(0.84<=A2,A2<=0.95,0.008<=B2,B2<=0.012),"yes","")

Unfortunately I do need it from two to three decimal places,
but this works perfectly... thanks!!
Just to be clear, my suggested use of ROUND did __not__ oppose your
need for "two or three decimal places". In fact, it supported it.
The point is: the computed value in A2 might __look__ like it is
between 0.84 and 0.95, but it might not be for various reasons.
If you want to ensure that the computed value in A2 is between 0.84
and 0.95 to two decimal places, it would be prudent to use ROUND as I
demonstrated previously.
Similarly for B2. But note that you can round B2 to 3 decimal places,
but round A2 to 2 decimal places, as you indicated in your
comparisons. They do not need to have the same number of decimal
places.
The only time you should not use ROUND is when you do not know how
many decimal places to use.
And of course you do not need to use ROUND as long as you can "get
away without it". There are many times when we do not care if the
displayed value is not exactly the same as the actual value.

I see, thank you for the information. I'll give your other forumla a try.
 

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