Skip to content

Instantly share code, notes, and snippets.

@loganvolkers
Last active April 9, 2024 19:30
Show Gist options
  • Save loganvolkers/933af8513ed8c2268f59c85a31761a43 to your computer and use it in GitHub Desktop.
Save loganvolkers/933af8513ed8c2268f59c85a31761a43 to your computer and use it in GitHub Desktop.
Byte formatting for Google Sheets
@fordsho
Copy link

fordsho commented Sep 17, 2021

Thank you so much for this, It made my life so much easier!!

@caio-vinicius
Copy link

Thank you very much!

@alexstorer
Copy link

This is very useful! I can only get it to format 3 options, so if you want the MB/GB/TB version instead of the KB/MB/GB version, this looks like it works:

[<1000000000]0.00,," MB";[<1000000000000]0.00,,," GB";0.00,,,," TB"

@pkowaluk
Copy link

pkowaluk commented Apr 1, 2022

Nice work, OP. Thanks 🌟

@mcsherrylabs
Copy link

Many thanks.

@OppamarkSEO
Copy link

Thank you this helped a lot.

@gorman42
Copy link

gorman42 commented Aug 6, 2023

Exactly what I was looking for. Works like a charm. Thank you!

@rsandros
Copy link

rsandros commented Aug 29, 2023

I solved this for nicely formatted binary bytes. Assuming you have raw bytes in field F4, use the formula below to multiply each value by the correct number of 1000/1024, and then use the suggested number format to display it as MB/GB/TB. No If statement needed. If you need to do math on it, just use the raw bytes that you started with, not after the 1000/1024 conversion.

=F4*10^(3*floor(log(F4,2)/10))/2^(10*floor(log(F4,2)/10))
[<1000000000]##0.00,," MB";[<1000000000000]##0.00,,," GB";##0.00,,,," TB"

image

Here's the number formatting guide: https://developers.google.com/sheets/api/guides/formats

@ns-kbhat
Copy link

ns-kbhat commented Mar 6, 2024

super useful!

@ortarab
Copy link

ortarab commented Apr 3, 2024

Briliant!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment