HEX2OCT Function
The HEX2OCT
function in Google Sheets converts a hexadecimal number to its octal equivalent.
Syntax
HEX2OCT(signed_hexadecimal_number, [significant_digits])
signed_hexadecimal_number
: The hexadecimal number you want to convert. This is a required parameter.significant_digits
: (Optional) The number of digits you want the octal number to contain.
Examples
- Basic Conversion
Convert the hexadecimal number ‘1A’ to octal:
=HEX2OCT("1A")
This will output 32.
- Conversion with Significant Digits
Convert the hexadecimal number ‘1A’ to octal with 4 significant digits:
=HEX2OCT("1A", 4)
This will output 0032.
- Conversion of a Negative Number
Convert the hexadecimal number ‘-F’ to octal:
=HEX2OCT("-F")
This will output 7777777771.
Notes
- The HEX2OCT function can handle hexadecimal numbers up to 10 characters long.
- If significant_digits is provided, the octal result will be padded with leading zeros to match the specified length.