Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9
Default Lenght of a decimal part of a number.

Hi, I am doing some programming where I need to know the number of digits of
the only decimal part of a number. I ended up with the following equation:

In cell A1 I entered a decimal number.
In cell B1 I wrote the following : =LEN(A1-INT(A1))
this should give me the numbers of the decimal part.

Examples:
A1 B1
100 1
10.25 4
3.2 3
6.7 3
9.2 17 WHY? this my question.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,268
Default Lenght of a decimal part of a number.

Try

=A5-INT(A5)

copy the result and paste special as values in a cell, now check what you
got


http://www.cpearson.com/excel/rounding.htm



--


Regards,


Peo Sjoblom


"Yara" wrote in message
...
Hi, I am doing some programming where I need to know the number of digits
of
the only decimal part of a number. I ended up with the following equation:

In cell A1 I entered a decimal number.
In cell B1 I wrote the following : =LEN(A1-INT(A1))
this should give me the numbers of the decimal part.

Examples:
A1 B1
100 1
10.25 4
3.2 3
6.7 3
9.2 17 WHY? this my question.



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 733
Default Lenght of a decimal part of a number.

Yara wrote...
Hi, I am doing some programming where I need to know the number of
digits of the only decimal part of a number. . . .

....
In cell B1 I wrote the following : =LEN(A1-INT(A1))

....

Use

=LEN(ABS(A1))-LEN(INT(ABS(A1)))-(A1<INT(A1))

instead.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 40
Default Lenght of a decimal part of a number.

or you could try this

=LEN(TEXT(A5-INT(A5),"#.#####"))-1

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,202
Default Lenght of a decimal part of a number.

Hi, I am doing some programming where I need to know the number of
digits of the only decimal part of a number. . . .

...
In cell B1 I wrote the following : =LEN(A1-INT(A1))


Use

=LEN(ABS(A1))-LEN(INT(ABS(A1)))-(A1<INT(A1))

instead.


Here is a shorter formula which also appears to work...

=MAX(0,LEN(A1)-FIND(".",A1&"."))

Rick
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
lenght of status bar Chris Excel Discussion (Misc queries) 2 November 20th 06 11:36 AM
Converting 2-place decimal value to floating point decimal number with leading zero Kermit Piper Excel Discussion (Misc queries) 3 March 18th 06 06:20 PM
converting number string to number with decimal rortiz Excel Worksheet Functions 2 September 15th 05 08:34 PM
Calculating a sum of various lenght ASA Excel Worksheet Functions 3 July 13th 05 05:20 AM
How to convert a decimal number to a non-decimal number? snickers22 Excel Worksheet Functions 4 January 13th 05 10:04 PM


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

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

About Us

"It's about Microsoft Excel"