Determining File Size

  • Thread starter Thread starter davidm
  • Start date Start date
D

davidm

:(
To calculate the size of a file, say, Tester.xls, we use:

Format(FileLen("Tester.xls")*0.0009767,"0") & "KB"

Can someone explain the use of the the factor* 0.0009767* (rather than
the customary .001) in converting the bytes into Kilo Bytes?


David
 
Hello Davidm,

The file size is returned in true kilobytes (1024 bytes per kilobyte
if you multiply 1024 times 0.0009767 yields 1 kilobyte instead of 1.02
kilobytes.

Sincerely,
Leith Ros
 
Because there are 1024 bytes in a kilobyte, not 1000.

Divide 1000 by 1024000 and you get 0.00097656. So you number is slightly
askew by my calculations.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
Thanks Leith and Bob for the explanation. By the way, isn't it strang
that a "kilo" for once doesn't denote 1,000?

David
 
I think the program considers 2^10, or 1,024 to be a kilobyte. instead of
1,000.
Therefore, the ratio 1 kb / 1024 , equals 0.0009765625.

HTH. :>)
 
Diana,

So by logical extension, can I construct *I mega-byte* as:

I mg = 1 million bytes (approx)
= 1 Kb (Excel's) x 1,000 approx.
= (2 ^10 )bytes x 1,000 approx
=(2 ^10 )bytes x 2 ^10
= 2^20 bytes
= 1,048,576 bytes ?

Hence, to convert N bytes to Megabytes, the correspondin
multiplication factor
could be 1/1048576 = 9.5367 x 10^
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top