ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   count of digit in a number (https://www.excelbanter.com/excel-programming/359868-count-digit-number.html)

Shira

count of digit in a number
 
does anyoone know if there is a function that count the number of digit in a
number?

Dave Peterson

count of digit in a number
 
Maybe:
=len(a1)



SHIRA wrote:

does anyoone know if there is a function that count the number of digit in a
number?


--

Dave Peterson

Jim Thomlinson

count of digit in a number
 
You can use this formula. It counts the number of digits for the number in
cell A1. Note that it counts the number of digits entered, not the number of
digits displayed. for instance if the number is formatted to show 2 decimals
and the number 5 is enetered, the cell will show 5.00, but since only 1 digit
was entered the formula will return 1...

=IF(ISERROR(FIND(".",A1)), LEN(ABS(A1)), LEN(ABS(A1))-1)

also I assume you don't count the decimal as a digit, nor the negative sign.
--
HTH...

Jim Thomlinson


"SHIRA" wrote:

does anyoone know if there is a function that count the number of digit in a
number?


Shira

count of digit in a number
 
this was simple :)

"Dave Peterson" wrote:

Maybe:
=len(a1)



SHIRA wrote:

does anyoone know if there is a function that count the number of digit in a
number?


--

Dave Peterson


RB Smissaert

count of digit in a number
 
You will have to be careful with that:

Sub test()

Dim d As Double

d = 100
MsgBox Len(d)

End Sub

May have to do:
MsgBox Len(CStr(d))


RBS


"Dave Peterson" wrote in message
...
Maybe:
=len(a1)



SHIRA wrote:

does anyoone know if there is a function that count the number of digit
in a
number?


--

Dave Peterson




All times are GMT +1. The time now is 10:37 PM.

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