Cell can only equal Whole Number

T

TriFiV

I need set up a formula so that if the answer is not a whole number, an error
message will show. Thank you.
 
G

Gary''s Student

Let's say we are interested in =A1/A2 being an integer, use:

=IF(INT(A1/A2)*A2=A1,A1/A2,"ERROR")

so if A1 is 12 and A2 is 6 you will see 2
if A1 is 13 and A2 is 6 you will see ERROR


The general form is :
=IF(INT(A1)=A1,A1,"ERROR")
 
D

David Biddulph

TriFiV said:
I need set up a formula so that if the answer is not a whole number, an
error
message will show. Thank you.

=IF(MOD(your formula,1)=0,your formula, "Error")
 
Top