Excel formula problem =IF(0<B7<20;1;0)

  • Thread starter Thread starter flemminga
  • Start date Start date
F

flemminga

Need excel to return the value 1 if the value in field B7 is larger tha
0 and smaller than 20.

=IF(B7<20;1;0) kinda works except that if B7 is empty 1 is returned

I then tried to indicate the range from 0 to 20, by doing this:

=IF(0<B7<20;1;0) this results in excel returning 0 no matter what
write in field B7

What am I doing wrong?

Flemmin
 
One way........

Hi Flemming.........

KYou had the right idea, but you structured the "AND" part of your "IF"
statement
a little wrong. Frank shows you how to do it properly with his formula of

=IF(AND(B7>0,B7<20);1;0) only thing is, he used semicolons where my
version
of Excel (and maybe yours), requires commas......like

=IF(AND(A1>0,A1<20),1,0)

Another way to get the job done would be.......

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


Vaya con Dios,
Chuck, CABGx3
 
Hi Chuck,

Out of interest why did you use the double unary with the IF formulas?
Using a double unary you can miss out the IF's altogether as in:

=--AND(A1>0,A1<20)

Regards

Sandy

--
to e-mail direct replace @mailintor.com with @tiscali.co.uk

CLR said:
One way........

Hi Flemming.........

KYou had the right idea, but you structured the "AND" part of your "IF"
statement
a little wrong. Frank shows you how to do it properly with his formula of

=IF(AND(B7>0,B7<20);1;0) only thing is, he used semicolons where my
version
of Excel (and maybe yours), requires commas......like

=IF(AND(A1>0,A1<20),1,0)

Another way to get the job done would be.......

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


Vaya con Dios,
Chuck, CABGx3
 
I just came home from a congress to find all your answers. Thank yo
very much guys! This not only solved the current problem but also gav
me some much needed insight into excel syntax.
Thank you once again
Flemmin
 
Back
Top