4

I want to create a cell in and Excel spreadsheet that can only have Even numbers entered into it and also one just for Odd numbers. Any ideas what formula I can put into the Data Validation formula to be able to do this. Thank you.

4
  • 7
    Something in Excel?
    – jonsca
    Jun 16, 2011 at 20:33
  • since people are commenting that the topic is not clear, even though the tag says data-validation, you might add excel into the question, if it is an excel question.
    – datatoo
    Jun 16, 2011 at 21:04
  • 2
    Voting to reopen since he clarified the question Jun 16, 2011 at 21:44
  • Divide each value by two and if there is a remainder you know it is Odd, if no remainder, even. Jun 16, 2011 at 21:46

2 Answers 2

4

In the cells you want to check for even set the data validation to custom, then in the formula

=NOT(MOD(A2,2))

check odd numbers in the same way with the formula

=MOD(A3,2)

of course adjusting the cell address, the style, and Error Alert you want in response

0
0

Here's an alternative that uses Excel's Odd and Even functions. Assuming you are validating for even in A2 and Odd and A3. Enter these as Custom formulas in the Data Validation dialog:

=A2=EVEN(A2)
=A3=ODD(A3)
3
  • these do produce odd or even results, but change them for the user, rather than demanding they enter either and odd or even value. perhaps that is enough for the situation, but seems error prone
    – datatoo
    Jun 18, 2011 at 16:00
  • @ datatoo I've edited my answer to clarify that these would be entered as Custom formulas in the Data Validation dialog. I thought that was assumed since it's what the OP asked for. Jun 19, 2011 at 2:02
  • you were right to assume that, since that was the question, sorry
    – datatoo
    Jun 19, 2011 at 17:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .