View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
 
Posts: n/a
Default how to diferentiate integers with decimals in the IF formulas

decimal seperator wrote:
Subject: how to diferentiate integers with decimals in the IF formulas


I think your question is: how to recognize integral numbers.
One answer:

=IF(INT(A1) = A1, "integral number", "non-integral number")

Caveat: If A1 is the result of a formula that involves non-integral
numbers, the result might appear to be an integral number in
the cell, but it really is not. In that case, it might be better to
write:

=IF(ABS(A1-INT(A1)) < 1E-6, "integral number", "non-integral number")

where you might choose something other than 1E-6, depending
on your tolerance or cell format.

Alternatively, you might set the option Tools Options
Calculation Percision as Displayed. But that might have
unexpected consequences.

Etiquette note: In the future, always include text in your
message, even if it simply repeats the subject line. Some
newsgroup readers do not show the entire subject line.
Some newsgroup readers do not permit replies to postings
with null text(!).