View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
zvkmpw zvkmpw is offline
external usenet poster
 
Posts: 153
Default IF Statement accepting only positive values

In column A, I have text in cells A1:A10, in column B, I want to put in
a formula saying "If A1 contains 'test text', then only accept a
positive number" and return an error if a negative number is attempted
to be typed in. How do I do this?


Select column B and in
Data Data tools Data Validation Settings
put

Allow:
Custom

Formula:
=OR(A1<"test text", B10)
(The post doesn't say what to do if zero is entered in column B.
The formula assumes it's lumped in with the negative; if not,
change "B10" to "B1=0")

Then click the "Error Alert" tab and enter the desired error message.

Finally, click "OK"

Hope this helps getting started.