If then Question

  • Thread starter Thread starter Ben
  • Start date Start date
B

Ben

Hello,

How do I set and if statement to be true if the cell
contains a number less than 1? I have tried the
following:

=IF(D25=<1,"ERROR","")

This works for number but you can type in letters and it
still comes out true. How do you set it so that it only
comes out true if a number less than 1 is entered?
 
Ben,

One way (I'm sure there are many others):

=IF(ISNUMBER(D25),IF(D25<=1,"ERROR",""),"")

John
 
Hi Ben!

Close!

=IF(D25<1,"ERROR","")

You can check conditions outside an IF function using (e.g.)

=D25<1

Then you can take it (without the = and plonk it in your IF function.
Quite useful for testing what's allowed, for multiple conditions using
AND or OR and for testing individual possibilities in nested IF
functions.
--
Regards
Norman Harker MVP (Excel)
Sydney, Australia
(e-mail address removed)
Excel and Word Function Lists (Classifications, Syntax and Arguments)
available free to good homes.
 
Don,

Thanks for the reply. I realized after re-reading my post
I asked the question wrong. I want it to display "error"
if any alpha character is entered or a numeric character
less than 1 is entered. Currently it works if a numeric
character entered is less than 1 but not if any alpha
character is entered.

Thanks,
ben
 
John,

Thanks for the reply. I realized after re-reading my post
I asked the question wrong. I want it to display "error"
if any alpha character is entered or a numeric character
less than 1 is entered. Currently it works if a numeric
character entered is less than 1 but not if any alpha
character is entered.

Ben
 
John,

Since I asked the wrong question I simply made this edit
and it worked.

=IF(ISNUMBER(D25),IF(D25<1,"ERROR",""),"ERROR")

Thanks!!!
Ben
 
Ben,

Glad to have been a help.

John

Ben said:
John,

Since I asked the wrong question I simply made this edit
and it worked.

=IF(ISNUMBER(D25),IF(D25<1,"ERROR",""),"ERROR")

Thanks!!!
Ben
 
Hi Ben!

Try:
=IF(A1="","",IF(OR(ISTEXT(A1),A1<1),"error",""))


--
Regards
Norman Harker MVP (Excel)
Sydney, Australia
(e-mail address removed)
Excel and Word Function Lists (Classifications, Syntax and Arguments)
available free to good homes.
 
Back
Top