I don't know of a way to make it show you binary gigabytes (multiples of 1024x1024x1024) but you can make it show you decimal gigabytes using a format like:
Though Excel format conditions will only display 1 of 3 conditions related to number size (they code it as "positive; negative; zero; text" but I prefer to see it as : if isnumber and true; elseif isnumber and false; elseif number; elseif is text )
so to me the best answer is David's as well as Grastveit's comment for other regional format.
Here are the ones I use depending on reports I make.
I use CDH hadoop and when I export excel report, I have two problems;
1) convert Linux date to excel date,
For that, add an empty column next to date column lets say the top row is B4,
paste below formula and drag the BLACK "+" all the way to your last day at the end of the column. Then hide the original column
=(((B4/1000/60)/60)/24)+DATE(1970|1|1)+(-5/24)
2) Convert disk size from byte to TB, GB, and MB
the best formula for that is this
The above formatting approach works but only for three levels. The above used KB, MB, and GB. Here I've expanded it to six. Right-click on the cell(s) and select Format Cells. Under the Number tab, select Custom. Then in the Type: box, put the following:
Then select OK. This covers B, KB, and MB. Then, with the same cells selected, click Home ribbon, Conditional Formatting, New Rule. Select Format only cells that contain. Then below in the rule description, Format only cells with, Cell Value, greater than or equal to, 1000000000 (that's 9 zeros.) Then click on Format, Number tab, Custom, and in the Type: box, put the following:
Select OK, and OK. This conditional formatting will take over only if the value is bigger than 1,000,000,000. And it will take care of the GB, TB, and PB ranges.
Anything bigger than PB will just show up as a bigger PB, e.g. 56,700 PB. You could add another conditional formatting to handle even bigger values, EB, and so on.
And, yet another solution, is to use engineering notation. (That's like scientific notation except the exponent is always a multiple of 3.) Right-click on the cell(s) and select Format Cells. Under the Number tab, select Custom. Then in the Type: box, put the following:
##0.00E+00
Then click OK. Instead of K, M, etc, you'll have +3, +6, etc. This will work for positive and negative numbers, as well as positive and negative exponents, -3 is m, -6 is u, etc.
All the answers here supply values with powers of 10. Here is a format using proper SI units (multiples of 1024, i.e. Mebibytes, Gibibytes, and Tebibytes):
Because nobody wrote this answer yet I thought it would be good for future thread finders. There is an easy way to do conversions in excel for bits and byte with the conversion function.
You just need to use =CONVERT(Number or Cell, "fromDatatype", "toDatatype")