Count number of decimal places

This tutorial shows how to count the number of decimal places using an Excel formula, with the IF, INT, LEN and FIND functions

EXCEL FORMULA 1. Count number of decimal places

EXCEL

Hard coded formula
Count number of decimal places
Cell reference formula
Count number of decimal places
=IF(72.247=INT(72.247),0,LEN(72.247)-FIND(".",72.247,1))
=IF(B5=INT(B5),0,LEN(B5)-FIND(".",B5,1))
GENERIC FORMULA

=IF(number=INT(number),0,LEN(number)-FIND(".",number,1))

ARGUMENTS
number: The number from which you want to count the number of decimal places.

GENERIC FORMULA

=IF(number=INT(number),0,LEN(number)-FIND(".",number,1))

ARGUMENTS
number: The number from which you want to count the number of decimal places.

EXPLANATION

This formula uses the FIND function to return the position of a full stop from a number, including the full stop. The LEN function is then used to return the total number of characters from the selected number. The formula then subtracts the number derived by the FIND function, which represents the number of characters of the integer component, including the full stop, from the total number of character of the selected number to return the total number of decimal places. At the beginning of formula the IF and INT functions are used to return a value of 0 if the selected number doesn't have any decimal places, therefore, being only an integer number.

Click on either the Hard Coded or Cell Reference button to view the formula that has the number from which you want to count the number of decimal place directly entered into the formula or referenced to a specific cell.

RELATED TOPICS

Related Topic Description Related Topic and Description
How to extract the nth decimal number
How to count the total number of specific characters in a cell

RELATED FUNCTIONS

Related Functions Description Related Functions and Description
The Excel IF function performs a test on specified conditions entered into the formula and returns a specified value if the result is TRUE or another specified value if the result is FALSE
The Excel LEN function returns the number of characters in a specified string
The Excel FIND function returns the position of a specific sub-string within a string