Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 18
Default Convert bytes to kilobytes or megabytes?

I have a list of files that include the file size listed in bytes. I need to
convert these files sizes into Megs or K's or leave them as bytes. For
example what I have is...

File name Size in bytes
Tiny file 3
Medium file 153,600
Large file 5,242,880

What I need is...
File name Size
Tiny file 3 bytes
Medium file 150k
Large file 5 megs

Any ideas?

Thanks in advance
Toney
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,420
Default Convert bytes to kilobytes or megabytes?

=IF(A5<10^3,A5&"
bytes",IF(A5<10^6,ROUND(INT(A5/10^3),-1)&"k",ROUND(INT(A5/10^6),1)&" megs"))

--
__________________________________
HTH

Bob

"Toney" wrote in message
...
I have a list of files that include the file size listed in bytes. I need
to
convert these files sizes into Megs or K's or leave them as bytes. For
example what I have is...

File name Size in bytes
Tiny file 3
Medium file 153,600
Large file 5,242,880

What I need is...
File name Size
Tiny file 3 bytes
Medium file 150k
Large file 5 megs

Any ideas?

Thanks in advance
Toney



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,722
Default Convert bytes to kilobytes or megabytes?

One kilobyte < 1000 bytes. (based on OP's example and result, he is using
the correct calculation of 1 kb = 2^10 bytes.

=IF(A5<2^10,A5&" bytes",IF(A5<2^20,ROUND
(INT(A5/2^10),-1)&"k",ROUND(INT(A5/2^20),1)&" megs"))


--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Bob Phillips" wrote:

=IF(A5<10^3,A5&"
bytes",IF(A5<10^6,ROUND(INT(A5/10^3),-1)&"k",ROUND(INT(A5/10^6),1)&" megs"))

--
__________________________________
HTH

Bob

"Toney" wrote in message
...
I have a list of files that include the file size listed in bytes. I need
to
convert these files sizes into Megs or K's or leave them as bytes. For
example what I have is...

File name Size in bytes
Tiny file 3
Medium file 153,600
Large file 5,242,880

What I need is...
File name Size
Tiny file 3 bytes
Medium file 150k
Large file 5 megs

Any ideas?

Thanks in advance
Toney




  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 18
Default Convert bytes to kilobytes or megabytes?

Thanks for your help. Between the two answers i figured out how to do this.

Thanks again

Toney
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 18
Default Convert bytes to kilobytes or megabytes?

Thanks for your help. Your reply was just a bit more spot on with the using
the 1024 byte/k. Between the two answers I figured out how to do this.

Thanks again

Toney


  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Convert bytes to kilobytes or megabytes?

On Friday, September 11, 2009 at 1:16:02 PM UTC-7, Toney wrote:
Thanks for your help. Your reply was just a bit more spot on with the using
the 1024 byte/k. Between the two answers I figured out how to do this.

Thanks again

Toney


Sorry for the 9 year old thread resurrection, but here is an expansion that covers through petabytes in case anyone finds it useful :)


=IF(A5<2^10,A5&" bytes",IF(A5<2^20,ROUND (INT(A5/2^10),-1)&"kb",IF(A5<2^30,ROUND (INT(A5/2^30),-1)&"mb",IF(A5<2^40,ROUND (INT(A5/2^30),-1)&"gb",ROUND(INT(A5/2^40),1)&" tb"))))
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding bytes, gigabytes, and megabytes in Excel NetTech Excel Worksheet Functions 4 April 3rd 23 06:47 PM
Time and megabytes ACarella Excel Worksheet Functions 4 November 12th 08 02:07 PM
0 bytes andy Excel Discussion (Misc queries) 6 May 9th 08 01:28 PM
How many bytes? GARY Excel Discussion (Misc queries) 0 April 15th 06 09:31 PM
Add kilobytes to megabytes in the convert function Matt Thompson Excel Worksheet Functions 2 October 5th 05 04:20 PM


All times are GMT +1. The time now is 03:05 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"