Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Old September 10th 09, 07:25 PM posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
First recorded activity by ExcelBanter: Oct 2008
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  
Old September 10th 09, 07:35 PM posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
First recorded activity by ExcelBanter: Jun 2008
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  
Old September 10th 09, 08:26 PM posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
First recorded activity by ExcelBanter: Dec 2007
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  
Old September 11th 09, 09:15 PM posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
First recorded activity by ExcelBanter: Oct 2008
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  
Old September 11th 09, 09:16 PM posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
First recorded activity by ExcelBanter: Oct 2008
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  
Old October 24th 18, 02:02 AM posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
First recorded activity by ExcelBanter: Oct 2018
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
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
Adding bytes, gigabytes, and megabytes in Excel NetTech Excel Worksheet Functions 3 July 3rd 07 05:43 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 02:13 PM.

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

About Us

"It's about Microsoft Excel"

 

Copyright © 2017