Last active
April 12, 2023 16:49
-
-
Save carrgilson/cfbad6e63894bb671410c19697837d23 to your computer and use it in GitHub Desktop.
Microsoft Excel Formula - Formatted Bytes to Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=LET( | |
README_,"This formula converts a formatted byte count to a raw byte count", | |
README1,"Adjust the below [variable] definitions to your need, where the viable options are (bracketed)", | |
README2,"[cell] specify the individual cell address containing the byte count to format, this should be contained within double quotation marks", | |
README3,"[cell_style] define if you're using the R1C1 (rowcolumn) or the A1 (alphanumeric) cell reference style", | |
README4,"[unit_type] define if you want the resulting output calculated to a base 2 (binary) or base 10 (metric) value", | |
CONSTANTS,"Do not alter these", | |
binary,1024, | |
metric,1000, | |
rowcolumn,0, | |
alphanumeric,1, | |
VARIABLES,"Adjust these to your need", | |
cell,"RC[-1]", | |
unit_type,binary, | |
cell_style,rowcolumn, | |
value,LEFT(INDIRECT(cell,cell_style),SUM(LEN(INDIRECT(cell,cell_style))-LEN(SUBSTITUTE(INDIRECT(cell,cell_style),{"0","1","2","3","4","5","6","7","8","9"," ","."},"")))), | |
unit,TRIM(RIGHT(INDIRECT(cell,cell_style),LEN(INDIRECT(cell,cell_style))-LEN(value))), | |
IF(OR(unit="k",unit="kb",unit="kib"),value*unit_type, | |
IF(OR(unit="m",unit="mb",unit="mib"),value*unit_type*unit_type, | |
IF(OR(unit="g",unit="gb",unit="gib"),value*unit_type*unit_type*unit_type, | |
IF(OR(unit="t",unit="tb",unit="tib"),value*unit_type*unit_type*unit_type*unit_type, | |
IF(OR(unit="p",unit="pb",unit="pib"),value*unit_type*unit_type*unit_type*unit_type*unit_type, | |
IF(OR(unit="e",unit="eb",unit="eib"),value*unit_type*unit_type*unit_type*unit_type*unit_type*unit_type, | |
IF(OR(unit="z",unit="zb",unit="zib"),value*unit_type*unit_type*unit_type*unit_type*unit_type*unit_type*unit_type, | |
IF(OR(unit="y",unit="yb",unit="yib"),value*unit_type*unit_type*unit_type*unit_type*unit_type*unit_type*unit_type*unit_type | |
))))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment