HEX2OCT Function in Google Sheets

Convert a hexadecimal number to an octal number using the HEX2OCT function.

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

  1. Basic Conversion

Convert the hexadecimal number ‘1A’ to octal:

=HEX2OCT("1A")

This will output 32.

  1. Conversion with Significant Digits

Convert the hexadecimal number ‘1A’ to octal with 4 significant digits:

=HEX2OCT("1A", 4)

This will output 0032.

  1. 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.
  • HEX2DEC: Convert a hexadecimal number to a decimal number.
  • HEX2BIN: Convert a hexadecimal number to a binary number.