Custom formatting code - rounding problem

venkys4u

New Member
Joined
Aug 12, 2012
Messages
1
Here the problem raises with rounding the two decimal values. But i need like using trunc in custom formatting. I need the values not to get rounded with decimal but display as it was.

Problem 1

[>=1000000]$#0.00,, "M";[>=100000]$#0.00, "K";$#.00

this code converts millions and K with 2 decimals but it is rounding the first two digits

Values:106,008,784.41 69158976 36849808.41
when we divide by million we get the below values
106.0087844
69.15897636.84980841

<colgroup><col width="167"><col width="147"><col width="150"></colgroup><tbody>
</tbody>

Expected: 106.00 69.15 36.84
Actual: 106.01M 69.16M 36.85M (result of my code)


Problem 2

[>0] +##%;[<0]-##%;0

this code works as if it greater than 0 say 1, then display as +100% , lesser than 0 say -1 then -100% else 0

but it goes without values, when between (0.009 , -0.009) resulting like + % or -%. Say If the values between (0,-0.009) then resulting -%

( to simply the problem occurs when it is lesser then +or- 1 percentage)

So i need it to round 0 if the values between (+0.9,-0) and (0,-.9)

Suggestions , codes are welcome, thanked and highly appreciated.


Thanks in advance.
venky
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

Forum statistics

Threads
1,214,630
Messages
6,120,634
Members
448,973
Latest member
ChristineC

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top