XLsfunctions

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need a function in XLs that works as below
return 0 if 0<my number<0.5
return 1 if 0.5<my number<1
 
Assuming your number between 0 and 1

=IF(AND(A1>0.5,A1<1),1,0)
or
=(A1>0.5)+0
 
You didn't say what you wanted to happen if other values were entered, nor if
the value is 0.5.
The following will return the text "Out of range" for any value 0 or below,
1 and above or for exactly 0.5:
=IF(AND(F4>0,F4<0.5),0,IF(AND(F4>0.5,F4<1),1,"Out of Range"))

To return 1 for 0.5:
=IF(AND(F4>0,F4<0.5),0,IF(AND(F4>=0.5,F4<1),1,"Out of Range"))

To return 0 for 0.5:
=IF(AND(F4>0,F4<=0.5),0,IF(AND(F4>0.5,F4<1),1,"Out of Range"))
 
=ROUND(A1,0) would do it, but you haven't said what you want to happen if
your number is equal to 0.5, or <=0, or >=1.
 

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

Back
Top