Contact

OCT2BIN in Google Sheets: Expand Octal Fields and Preserve Signed Values

Engineering Intermediate Google Sheets

Convert octal text to binary in Google Sheets, map three-bit groups, check the narrower signed target range and verify fixed-width round trips.

Verification status: See the evidence and test scope described in this guide. How formula examples are checked

Quick answer: OCT2BIN(signed_octal_number,[significant_digits]) converts signed octal text to binary. The target supports quantities from −512 through 511, so valid larger octal quantities need a different representation.

Availability and version history

  • Introduced: first introduction date is not established by the reviewed official history; no desktop release number is inferred.
  • Availability: documented in the rolling Google Sheets service; these examples use the web worksheet workflow.
  • Checked: October 14, 2026; official OCT2BIN reference. Documentation and independent models, with no native Sheets execution or wider client certification.

Syntax and the target constraint

=OCT2BIN(signed_octal_number,[significant_digits])

Google describes the input as a thirty-bit signed octal value, but gives a maximum admitted positive input of 777 and a negative minimum of 7777777000 for this conversion. Those represent 511 and −512.

A valid numeric digit input is converted to its string form. Numeric 177 and text “177” both represent octal 177, or decimal 127, and the reference gives binary 1111111. Decimal 177 would require a different binary result, so be clear about what the input digits mean.

The optional significant_digits argument pads a nonnegative result with leading zeros. Too few positions produces #NUM!. Negative signed inputs ignore this width. The page does not establish fractional-width truncation or a complete coercion/error table.

Example 1: expand three octal digits into nine bits

Format A2:A6 as Plain text and enter only the first column. In B2 enter =OCT2BIN(A2,9) and fill down. The decimal column is an explanatory check rather than a pasted input in B.

A, octal text B, nine-bit output Decimal check
011 000001001 9
052 000101010 42
134 001011100 92
245 010100101 165
552 101101010 362

For octal 134, replace each digit with its three-bit form: 1 becomes 001, 3 becomes 011 and 4 becomes 100. Joining these gives 001011100. The weighted decimal check is 1×64+3×8+4=92.

For 552, the groups are 101 101 010. This nine-character representation remains positive under the family’s ten-bit signed rule. A leading one in fewer than ten binary positions does not by itself denote a negative input for BIN2DEC.

Example 2: distinguish short positive octal from full negatives

Formula Expected binary
=OCT2BIN("773",9) 111111011
=OCT2BIN("7777777773",4) 1111111011
=OCT2BIN("7777777000",4) 1000000000
=OCT2BIN("777",10) 0111111111

The quantities are positive 507, negative −5, negative −512 and positive 511. The short 773 and the full thirty-bit negative ending in 773 are not interchangeable.

For −5, the target ten-bit two’s-complement model is 2^10−5=1019, giving 1111111011. A valid width of four is ignored for the negative controls.

Octal 1000 represents positive 512, just outside the documented output range. The guide does not invent a specific native error code for every range violation when the cited notes only explicitly name invalid digits and insufficient width.

Advanced example: audit the quantity and the original field

With the first fixture, put =OCT2DEC(A2) in C2 and =BIN2DEC(B2) in D2, filling down. Both return 9, 42, 92, 165 and 362. Comparisons =C2=D2 are all TRUE.

Then enter =BIN2OCT(B2,3) in E2 and fill down. Expected results are 011, 052, 134, 245 and 552. The explicit three-position width recreates this fixture’s field layout.

BIN2OCT has an inconsistent omitted-width example in its official reference, so this reverse check supplies the width rather than depending on that ambiguous example. A numeric round trip alone cannot recover an arbitrary original number of leading zeros.

Advanced example: calculate on the decoded quantity

The first two records represent 9 and 42, totaling 51. To return a nine-position binary total, use:

=DEC2BIN(OCT2DEC(A2)+OCT2DEC(A3),9)

Expected result: 000110011. For an octal output, =DEC2OCT(OCT2DEC(A2)+OCT2DEC(A3),3) gives 063.

Simply adding the displayed octal strings 011 and 052 yields decimal 63. It happens to look like the correct octal digits in this example, but that coincidence does not establish a valid general method. Octal 7 plus octal 1 must carry to 10, whereas ordinary decimal 7+1 produces 8, an invalid octal digit.

Errors and input checks

=OCT2BIN("128",9) contains a digit outside zero through seven and follows the documented #NUM! rule. =OCT2BIN("134",6) needs seven binary positions and follows the too-small-width error rule.

Use OCT2DEC when you need the decimal quantity, and DEC2BIN when the source already is decimal. Invalid widths, fractional inputs and general blank or Boolean coercion remain outside the verified source scope.

References and verification

Examples use fictional data, English function names and comma separators. Expected outputs are independent mathematical calculations or explicitly documented rules, not native Sheets captures. Check the spreadsheet locale when reproducing punctuation-sensitive formulas.