View Single Post
 
Old 02-06-2018, 06:18 AM
Alsadius Alsadius is offline Windows 7 64bit Office 2010 32bit
Novice
 
Join Date: Nov 2017
Posts: 25
Alsadius is on a distinguished road
Default

Quote:
Originally Posted by LearnerExcel View Post
Code:
 
=A1-TRUNC(A1)
Problem resolved.
That'll get him all decimals, not just the last three.

Assume we're dealing with 123.456789.

=A1-TRUNC(A1)
will result in 0.456789

=ROUND(A1-TRUNC(A1), 3)
will result in 0.457 (it rounds it off to three decimal places)

=(TRUNC((A1-TRUNC(A1))*1000))/1000
will result in 0.456 (this is a nasty formula, but it basically shifts the decimal three places and re-truncates)

=RIGHT(A1-TRUNC(A1), 3)
should result in 789 (though this one gave me a floating-point error when I tried it, which may mean it's bug-prone in practice and needs caution)

Which one you want depends on exactly what you're trying to do, but hopefully that should cover all the bases.
Reply With Quote