DEC2BIN Function
The DEC2BIN
function in Google Sheets is used to convert a decimal number to its binary equivalent.
Syntax
DEC2BIN(decimal_number, [significant_digits])
- decimal_number: The decimal number you want to convert. This is a required parameter.
- significant_digits: (Optional) The number of digits you want the binary number to contain.
Examples
- Basic Conversion
Convert the decimal number 10
to binary:
=DEC2BIN(10)
This will output 1010
.
- Conversion with Significant Digits
Convert the decimal number 5
to binary with 6 significant digits:
=DEC2BIN(5, 6)
This will output 000101
.
Notes
- The function can handle decimal numbers from
-512
to511
. - If
significant_digits
is provided, the binary result will be padded with leading zeros to match the specified length.