Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
7  
Something in Excel? –  jonsca Jun 16 '11 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 '11 at 21:04
2  
Voting to reopen since he clarified the question –  Darth Android Jun 16 '11 at 21:44
    
Divide each value by two and if there is a remainder you know it is Odd, if no remainder, even. –  music2myear Jun 16 '11 at 21:46
add comment

2 Answers

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

share|improve this answer
    
Thank you. It worked. –  gibson62 Jun 17 '11 at 21:23
add comment

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)
share|improve this answer
    
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 '11 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. –  Doug Glancy Jun 19 '11 at 2:02
    
you were right to assume that, since that was the question, sorry –  datatoo Jun 19 '11 at 17:20
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.