jesterspet
New Member
- Joined
- Aug 26, 2013
- Messages
- 6
I would like to refine my Lookup function from using static values to computed ones.
The function in question takes the value of a cell (in this case A5) that is given in raw bytes, and converts it into a more human readable format (e.g. 1.46KB, or 2.06GB rather than 1500, or 2211908157).
I would like to replace the larger numbers (1048576,1073741824,1099511627776) with computed values like POWER(1024,3) as the computed value is easier for me to read and remember. When I try to replace those static values with VALUE(POWER(1024,3) or N(POWER(1024,3) the formula no longer performs as intended and I get results like 221190 KB Instead of 2.06GB.
Could I get some enlightenment either on why this won't work, or how to do this correctly?
The function in question takes the value of a cell (in this case A5) that is given in raw bytes, and converts it into a more human readable format (e.g. 1.46KB, or 2.06GB rather than 1500, or 2211908157).
Code:
=ROUND(VALUE(CLEAN(A5)) / LOOKUP(VALUE(CLEAN(A5)), {0,1024,1048576,1073741824,1099511627776}, {1,1024,1048576,1073741824,1099511627776}), 2) & LOOKUP(VALUE(CLEAN(A5)), {0,1024,1048576,1073741824,1099511627776}, {" Bytes"," KB"," MB"," GB"," TB"})
I would like to replace the larger numbers (1048576,1073741824,1099511627776) with computed values like POWER(1024,3) as the computed value is easier for me to read and remember. When I try to replace those static values with VALUE(POWER(1024,3) or N(POWER(1024,3) the formula no longer performs as intended and I get results like 221190 KB Instead of 2.06GB.
Could I get some enlightenment either on why this won't work, or how to do this correctly?