Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Truncating to two decimals
Is there a way to trunkate to two decimals without rounding? For example:
123.45*31/12 = 318.9125 I need 318.91 234.97*42/11 = 897.15818, I need 897.15 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Truncating to two decimals
try:
0.01*int( 897.15818*100) "Phil H" wrote: Is there a way to trunkate to two decimals without rounding? For example: 123.45*31/12 = 318.9125 I need 318.91 234.97*42/11 = 897.15818, I need 897.15 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Truncating to two decimals
Is there a way to truncate to two decimals without rounding?
Here's one ideas: =INT(A1*100)/100 but with rounding... =ROUNDDOWN(A1,2) -- HTH. :) Dana DeLouis Windows XP, Office 2003 "Phil H" wrote in message ... Is there a way to trunkate to two decimals without rounding? For example: 123.45*31/12 = 318.9125 I need 318.91 234.97*42/11 = 897.15818, I need 897.15 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Truncating to two decimals
I use this if rounding isn't an issue
Range("B17:C21").Select Selection.NumberFormat = "0.00%" Range("I:I").Select Selection.NumberFormat = "0.00%" "Dana DeLouis" wrote: Is there a way to truncate to two decimals without rounding? Here's one ideas: =INT(A1*100)/100 but with rounding... =ROUNDDOWN(A1,2) -- HTH. :) Dana DeLouis Windows XP, Office 2003 "Phil H" wrote in message ... Is there a way to trunkate to two decimals without rounding? For example: 123.45*31/12 = 318.9125 I need 318.91 234.97*42/11 = 897.15818, I need 897.15 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Truncating to two decimals
On Wed, 26 Apr 2006 22:11:01 -0700, Phil H
wrote: Is there a way to trunkate to two decimals without rounding? For example: 123.45*31/12 = 318.9125 I need 318.91 234.97*42/11 = 897.15818, I need 897.15 As a worksheet formula, you could just use the TRUNC function: e.g. =TRUNC(your_formula,2) In VBA, Int(your_formula * 100) / 100 or Fix(your_formula * 100) / 100 depending on how you want to handle negative numbers. --ron |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Truncating to two decimals
=INT(A1*100)%
Regards, Bernd |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Truncating to two decimals
Thanks Ron, this is exactly what I needed.
"Ron Rosenfeld" wrote: On Wed, 26 Apr 2006 22:11:01 -0700, Phil H wrote: Is there a way to trunkate to two decimals without rounding? For example: 123.45*31/12 = 318.9125 I need 318.91 234.97*42/11 = 897.15818, I need 897.15 As a worksheet formula, you could just use the TRUNC function: e.g. =TRUNC(your_formula,2) In VBA, Int(your_formula * 100) / 100 or Fix(your_formula * 100) / 100 depending on how you want to handle negative numbers. --ron |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Truncating to two decimals
Glad to help. Thanks for the feedback.
On Fri, 28 Apr 2006 00:13:01 -0700, Phil H wrote: Thanks Ron, this is exactly what I needed. "Ron Rosenfeld" wrote: On Wed, 26 Apr 2006 22:11:01 -0700, Phil H wrote: Is there a way to trunkate to two decimals without rounding? For example: 123.45*31/12 = 318.9125 I need 318.91 234.97*42/11 = 897.15818, I need 897.15 As a worksheet formula, you could just use the TRUNC function: e.g. =TRUNC(your_formula,2) In VBA, Int(your_formula * 100) / 100 or Fix(your_formula * 100) / 100 depending on how you want to handle negative numbers. --ron --ron |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Count digits before decimals and after decimals | Excel Worksheet Functions | |||
Truncating a VIN | Excel Discussion (Misc queries) | |||
Truncating Decimals | Excel Discussion (Misc queries) | |||
numbers truncating | Excel Discussion (Misc queries) | |||
truncating a number in VB | Excel Programming |