Can't find function

ScotTFO

Board Regular
Joined
May 30, 2008
Messages
72
I am not sure if something like this even exists.

I am trying to add a formula that's pretty extensive and the end result comes out looking like this SOMETIMES.

"545.0000003 KB"

Is there a function I can add to the formula to trim the numbers down to 2 decimal places?

I guess I could use the LEFT function but I was just wondering if there was a better wya that would do rounding too.
 
Last edited:

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
I"m assuming your formula is a concatenate of some sort...

the part of the formula that produces the NUMBER, you can use TEXT to set the dicimal places..

=CONCATENATE(TEXT(formula that produces the number,"0.00")," KB")

Note that the number will be ROUNDED...
 
Upvote 0
When you are building up the value, use the ROUND function on the numbers before you add the "KB" (or MB or GB) part.
=ROUND(1080/1024,2)
for example.
 
Upvote 0
I tested them all and I think for my needs this one turned out to be the best solution but they all do work and I appreciate the help!

Yeah it's a bit of a beast of a code, and originally I did it all in VBA and it worked except now they are asking to have the cells update realtime so I am trying to replace all the VBA coding with these formulas so I am ending up with beasts, like this...

Code:
=IF(F16-D16>=1073741824,TEXT((F16-D16)/1024/1024/1024,"0.00")&" GB",IF(F16-D16>=1048576,TEXT((F16-D16)/1024/1024,"0.00")&" MB",IF(F16-D16>=1024,TEXT((F16-D16)/1024,"0.00")&" KB",IF(F16-D16>=-1024,TEXT((F16-D16),"0.00"),IF(F16-D16>=-1048576,TEXT((F16-D16)/1024,"0.00")&" KB",IF(F16-D16>=-1073741824,TEXT((F16-D16)/1024/1024,"0.00")&" MB",IF(F16-D16<1073741824,TEXT((F16-D16)/1024/1024/1024,"0.00")&" GB")))))))
The code is taking 2 cells that contain the byte sizes of folders that are pulled using VBA and the FileSystemObject. This formula is doing the math and finding out how much a user is over their alloted space and then formatting it into a common file size format that someone using this can understand.

Thanks again guys!
 
Upvote 0

Forum statistics

Threads
1,214,587
Messages
6,120,405
Members
448,958
Latest member
Hat4Life

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