Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Worksheet Functions / October 2007

Tip: Looking for answers? Try searching our database.

Lenght of a decimal part of a number.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Yara - 05 Oct 2007 21:23 GMT
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.
Peo Sjoblom - 05 Oct 2007 21:30 GMT
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

Signature

Regards,

Peo Sjoblom

> Hi, I am doing some programming where I need to know the number of digits
> of
[quoted text clipped - 11 lines]
> 6.7           3
> 9.2           17 WHY? this my question.
Harlan Grove - 05 Oct 2007 21:44 GMT
Yara <Y...@discussions.microsoft.com> 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.
cubbybear3 - 05 Oct 2007 21:53 GMT
or you could try this

=LEN(TEXT(A5-INT(A5),"#.#####"))-1
Rick Rothstein (MVP - VB) - 05 Oct 2007 22:27 GMT
>>Hi, I am doing some programming where I need to know the number of
>>digits of the only decimal part of a number. . . .
[quoted text clipped - 6 lines]
>
> instead.

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

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

Rick
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.