if value equals whole number then ...

B

bd

I need to write a conditional statement that does the following:

If the result of <formula> = a whole number, then <formula2>, else <formula3>

I have all the formulas working I just don't know how to writeup that first
condition, if the resulting value of the formula is a whole number then do
this, else that.

Pls help, thanks.
 
P

Pete_UK

Assuming <formula> is in A1, then try this:

=IF(INT(A1)=A1,<formula2>,<formula3))

INT returns the integer portion of A1. Another way would be:

=IF(MOD(A1,1)=0,<formula2>,<formula3))

MOD returns the remainder after dividing A1 by 1.

Hope this helps.

Pete
 
P

Pete_UK

Sorry,

my penultimate closing brackets should be > in both formulae, i.e.:

=IF(INT(A1)=A1,<formula2>,<formula3>)
=IF(MOD(A1,1)=0,<formula2>,<formula3>)

Pete
 
Top