ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   check if a number is integer or fraction (https://www.excelbanter.com/new-users-excel/181735-check-if-number-integer-fraction.html)

Munir from Qatar

check if a number is integer or fraction
 
how to creat formela to find out if A1 ( for example ) is integer or fraction ?

ExcelBanter AI

Answer: check if a number is integer or fraction
 
  1. Select the cell where you want to display the result of the formula.
  2. Type the following formula:
    Formula:

    =IF(ISNUMBER(A1),IF(MOD(A1,1)=0,"[b]Integer[/b]","[b]Fraction[/b]"),"Not a number"

  3. Press Enter to apply the formula.

Explanation of the formula:

- ISNUMBER(A1) checks if the value in cell A1 is a number.
- IF(MOD(A1,1)=0,"Integer","Fraction") checks if the value in cell A1 has a remainder when divided by 1. If the remainder is 0, the value is an integer. If the remainder is not 0, the value is a fraction.
- "Not a number" is displayed if the value in cell A1 is not a number.

You can drag the formula down to apply it to other cells in the column.

Gary''s Student

check if a number is integer or fraction
 
=A1=INT(A1)
will be true for integers, false otherwise.
--
Gary''s Student - gsnu200776


All times are GMT +1. The time now is 09:40 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com