Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default count of digit in a number

does anyoone know if there is a function that count the number of digit in a
number?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default 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


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default 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?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to validate a cell to insert from 9 digit number to 13 digit number. ramulu via OfficeKB.com Excel Worksheet Functions 1 February 21st 07 02:32 PM
How to validate a cell to insert from 9 digit number to 13 digit number. ramulu Excel Worksheet Functions 1 February 21st 07 10:00 AM
Color a single digit in a mult-digit number cell Phyllis Excel Discussion (Misc queries) 6 November 17th 05 12:46 AM
How do I identify the 7th digit in a 13 digit number, then establi Catherine Excel Worksheet Functions 7 April 4th 05 06:11 PM
When we enter a 16 digit number (credit card) the last digit chan. ceking Excel Discussion (Misc queries) 5 December 8th 04 11:45 PM


All times are GMT +1. The time now is 11:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"