Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
after I couldn't find some hints in the QV-Documentation and in this forum, i ask my question here.
Is there a possibilty to format with a Number which represents bytes in a human readable way?
For example:
xxx Bytes are xxx KBytes or xxx MByte or xxx MByte
Or maybe someone has written a small formula or something.
Thanks
Christoph
Hi Christoph,
Using the Hans' option, there's a formula to answer your problem :
=If(
div(div(div(sum([Number]),1024),1024),1024)>0,div(div(div(sum([Number]),1024),1024),1024)&' G',
If(div(div(sum([Number]),1024),1024)>0,div(div(sum([Number]),1024),1024)&' M',
If(div(sum([Number]),1024)>0,div(sum([Number]),1024)&' K',sum([Number)&' ')))&'Bytes'
Eric.
Hi,
1 MByte is 1024 KBytes
1 KByte is 1024 Bytes
So the following expression would give you the answer:
=Number &' Bytes are ' & Number/1024 & ' KBytes or ' & Number/1024/1024 & ' MBytes'
BR
Hans
Hi Hans,
thanks for your anwser. Sure this is maybe an option.
I'm searching for a solution where, if the bytes varies between kBytes, MBytes, GBytes and so on, the formula chooses the ideal measurement unit.
greets
Christoph
Hi Christoph,
Using the Hans' option, there's a formula to answer your problem :
=If(
div(div(div(sum([Number]),1024),1024),1024)>0,div(div(div(sum([Number]),1024),1024),1024)&' G',
If(div(div(sum([Number]),1024),1024)>0,div(div(sum([Number]),1024),1024)&' M',
If(div(sum([Number]),1024)>0,div(sum([Number]),1024)&' K',sum([Number)&' ')))&'Bytes'
Eric.
Hi Eric,
thanks for your code. It got me to the right direction.
I modified it a little bit, because I wanted to see the decimal.
Thanks
=If(div(div(div(sum([Number]),1024),1024),1024) >0,
num(sum([Number] / 1024 / 1024 / 1024), '#.##0,00') &' G',
If(div(div(sum([Number]),1024),1024)>0,
num(sum([Number] / 1024 / 1024), '#.##0,00') &' M',
If(div(sum([Number]),1024)>0,
num(sum([Number] / 1024), '#.##0,00') & ' K',
sum([Number]) & ' ' ))) & 'Bytes'