OCT2HEX Function in ONLYOFFICE Spreadsheet Editor: Syntax and Worked Examples
Convert base-eight values to hexadecimal identifiers, control output width, understand A–F digits, and diagnose documented input and width errors.
Verification status: Official documentation referenced; example outcomes independently reasoned or arithmetically checked where stated. Not executed in ONLYOFFICE Spreadsheet Editor. How formula examples are checked
Quick answer
Convert Octal Strings to Hexadecimal. Three octal digits can represent a byte: octal 377 becomes hexadecimal FF. Their characters differ because the base is different, not because the underlying value changed. The exact English-reference syntax is =OCT2HEX(number, [places]), documented by the official ONLYOFFICE OCT2HEX function article (checked 2026-10-13 UTC). Octal 377 = 255 decimal = hexadecimal FF; requesting five places produces 000FF as an independent mathematical expectation.
Verification: Results are independently calculated mathematical expectations. Native ONLYOFFICE Docs web or Desktop execution, localized parsing and runtime error capture were not performed.
Purpose, context and when to use OCT2HEX
OCT2HEX expresses the same integer in hexadecimal rather than octal. This can be useful when translating legacy octal configuration values to modern hex-oriented technical documentation or validating a base-conversion pipeline.
What the notation means
- Decimal/base 10: each digit’s value is weighted by powers of 10.
- Octal/base 8: valid digits are 0–7, weighted by powers of 8.
- Hexadecimal/base 16: digits are 0–9 and letters A–F (A=10 through F=15), weighted by powers of 16.
- A base conversion preserves the integer. Zero padding with
places(when supported) changes the output’s character count, not the represented quantity.
For a cell containing an octal or hexadecimal identifier, format it as Text before typing any leading zeros. Literal strings in the formulas are wrapped in double quotation marks, e.g. "377" rather than a bare number assumed to be octal. The underlying reference does not exhaustively specify every numeric-to-text coercion; check the stored cell type when recreating this worksheet.
Exact documented syntax, arguments and defaults
=OCT2HEX(number, [places])
| Argument position | Argument | Requirement and type | Meaning / documented default |
|---|---|---|---|
| 1 | number |
Required | An octal numeral made from digits 0–7, entered as text or passed by cell reference. Quoting the literal avoids confusion with decimal numbers and preserves leading zeros. |
| 2 | places |
Optional numeric width | Optional numeric count of hexadecimal digits in the result. When omitted, places defaults to the minimum number of hexadecimal digits. |
The square brackets around places (when present) mean optional, not literal square brackets to enter in the cell. The vendor reference orders the arguments exactly as printed above; swapping them changes the meaning. See the vendor’s documented syntax and notes.
Reproducible worksheet: from source input to expected output
- In a new, otherwise empty worksheet, enter
Scenarioin A1 andOctal source (Text)in B1. EnterPlacesin C1,Minimum outputin D1 andPadded outputin E1. - Format column B as Text before filling it; this preserves base digits and leading zeros. For reproducibility, enter the B-column source values from the rows below without the article’s backtick punctuation.
- Enter 5 as the numeric Places setting in C2:C21. Put
=OCT2HEX(B2)into D2, and=OCT2HEX(B2,C2)into E2; copy each formula down to row 21. - Compare the spreadsheet outputs to the independent expectations. If your installation differs, note the software edition and version, formula language, region, source cell type and entered formula. An expected result is not a claimed live test.
- Save the workbook with its sample values so a reviewer can repeat the comparison. To inspect a hidden leading zero, click the source cell and check the formula bar as well as the displayed cell.
Input and expected-output worksheet
| Row | Use case | B: source | C: places | D: Expected hex (minimum) | E: Expected hex (5 places) | Decimal cross-check |
|---|---|---|---|---|---|---|
| 2 | Zero | 0 |
5 | 0 |
00000 |
0 |
| 3 | One | 1 |
5 | 1 |
00001 |
1 |
| 4 | Last single octal digit | 7 |
5 | 7 |
00007 |
7 |
| 5 | Octal carry | 10 |
5 | 8 |
00008 |
8 |
| 6 | After carry | 11 |
5 | 9 |
00009 |
9 |
| 7 | Low nibble | 17 |
5 | F |
0000F |
15 |
| 8 | Second octal digit | 20 |
5 | 10 |
00010 |
16 |
| 9 | Five-bit value | 37 |
5 | 1F |
0001F |
31 |
| 10 | Power of two | 40 |
5 | 20 |
00020 |
32 |
| 11 | Six-bit maximum | 77 |
5 | 3F |
0003F |
63 |
| 12 | Eight squared: 64 | 100 |
5 | 40 |
00040 |
64 |
| 13 | ASCII A magnitude | 101 |
5 | 41 |
00041 |
65 |
| 14 | Small permission total | 113 |
5 | 4B |
0004B |
75 |
| 15 | Example of 83 | 123 |
5 | 53 |
00053 |
83 |
| 16 | Seven-bit maximum | 177 |
5 | 7F |
0007F |
127 |
| 17 | Eighth bit | 200 |
5 | 80 |
00080 |
128 |
| 18 | Full byte | 377 |
5 | FF |
000FF |
255 |
| 19 | First two octal blocks | 400 |
5 | 100 |
00100 |
256 |
| 20 | 12-bit maximum | 7777 |
5 | FFF |
00FFF |
4095 |
| 21 | 16-bit maximum | 177777 |
5 | FFFF |
0FFFF |
65535 |
Independent calculation method: Parse the input numeral in its stated source radix using exact integer arithmetic, then format that same integer in the destination radix. For the fixed-width column, left-pad the resulting string with the digit 0 to the requested width. These computations were checked with a separate Python integer conversion routine. That routine is not an ONLYOFFICE interpreter; outputs and text handling must still be verified in an installed editor.
Direct formulas to paste in an empty cell
| Formula | Expected output (independent) | Decimal cross-check |
|---|---|---|
=OCT2HEX("10") |
8 |
8 |
=OCT2HEX("17") |
F |
15 |
=OCT2HEX("113") |
4B |
75 |
=OCT2HEX("123") |
53 |
83 |
=OCT2HEX("245") |
A5 |
165 |
=OCT2HEX("377") |
FF |
255 |
=OCT2HEX("7777") |
FFF |
4095 |
=OCT2HEX("177777") |
FFFF |
65535 |
=OCT2HEX("17",5) |
0000F |
15 |
=OCT2HEX("123",5) |
00053 |
83 |
=OCT2HEX("377",5) |
000FF |
255 |
=OCT2HEX("177777",5) |
0FFFF |
65535 |
Reproducibility note: Quoted numeral literals keep the source notation intact. Results that look like text codes should not be coerced to ordinary decimals when copied into another program. To preserve fixed-width output, ensure destination cells have appropriate formatting before downstream use; the exact returned cell type is a native-test question.
Advanced uses and worked applications
1. Translate an octal byte
OCT2HEX expresses the same integer in hexadecimal rather than octal. For this application enter =OCT2HEX("377"); the independently expected result is FF. 377 octal = 255 decimal = FF hexadecimal.
2. Legacy permissions label
OCT2HEX expresses the same integer in hexadecimal rather than octal. For this application enter =OCT2HEX("755"); the independently expected result is 1ED. 755 octal = 493 decimal = 1ED hexadecimal. A numeric conversion does not decode the meaning of permission bits.
3. Nibble boundary
OCT2HEX expresses the same integer in hexadecimal rather than octal. For this application enter =OCT2HEX("20"); the independently expected result is 10. 20 octal = 16 decimal = 10 hexadecimal.
4. Maximum 16-bit positive label
OCT2HEX expresses the same integer in hexadecimal rather than octal. For this application enter =OCT2HEX("177777"); the independently expected result is FFFF. 177777 octal = 65535 decimal = FFFF hexadecimal, a four-hex-digit magnitude.
5. Cross-base confirmation without rounding
=OCT2HEX(DEC2OCT(255)) → FF; =OCT2HEX("377",5) → 000FF (mathematical expected values). These are independent compositions of documented functions, not formulas executed in ONLYOFFICE. Round-tripping is an excellent future desktop/web test, because it simultaneously probes coercion, function availability, and output text formatting. It is not evidence of behavior in any particular version.
6. Formula portability and identifiers
If using OCT2HEX for imported device codes, keep the original string and the converted string in separate columns. Add another column with the original base (8, 10 or 16) so downstream consumers do not interpret octal 377 as decimal 377. Retain the raw source when leading zeros or digit count carry meaning outside mathematics (for instance, a fixed-width external identifier).
Documented errors and troubleshooting
Only the rules explicitly attributed to the official OCT2HEX article are treated as vendor-established; the following error cases were not triggered in an actual ONLYOFFICE editor.
| Formula | Vendor-documented error category (not natively observed) | Diagnosis |
|---|---|---|
=OCT2HEX("889") |
#NUM! |
Digits 8 and 9 cannot occur in a valid octal numeral. |
=OCT2HEX("00000000000") |
#NUM! |
Eleven-character input violates the documented length restriction. |
=OCT2HEX("377",1) |
#NUM! |
377 octal requires hex FF, so one place is insufficient. |
=OCT2HEX("377",0) |
#NUM! |
Zero places violates the vendor positive-width requirement. |
Source-rule summary
- The vendor documents
#NUM!if the octal input is not recognized. - The vendor documents
#NUM!if the source contains more than 10 characters. - The vendor documents
#NUM!ifplacesis too small to fit the converted hexadecimal output. - The vendor documents
#NUM!ifplacesis less than or equal to zero.
Do not assume an outcome without checking the actual installed edition
- The reference does not give a full signed-input and two’s-complement model for ten-digit octal numbers. Do not treat other spreadsheet programs as ONLYOFFICE evidence.
- The exact output type, letter-case display, whitespace normalization, and noninteger width processing should be verified natively.
Practical troubleshooting sequence
- Verify the function name and argument count exactly against the official page. A one-argument-only function cannot take a width parameter.
- Verify the input base: octal uses
0–7; hexadecimal uses0–9andA–F; decimal is base 10. An apparently numeric cell might not contain the intended numeral representation. - If a leading zero matters, change the source cell to Text before re-entering the value. Verify the formula bar retains it.
- If the function has
places, first omit it to establish the shortest expected output mathematically; then enter a positive integer large enough for that output. A width counts characters, not bits or decimal places. - For an unexpected error, record the exact formula, source type, locale and app version; inspect the vendor’s documented error rules before attributing it to a specific behavior.
- If passing values between multiple conversion functions, inspect whether the intermediate result is textual or numeric in that exact editor. Do not conclude success merely because formatting makes a number look plausible.
Cases requiring native compatibility checks
=OCT2HEX("7777777777")(signed ten-digit convention is unspecified by the checked page).=OCT2HEX(" 377 ")(whitespace behavior not established).=OCT2HEX("377",1.5)(nonintegerplacesbehavior not established).=OCT2HEX("0000000377")(leading zeros make ten characters; inspect the target edition).
Platform, locale and release-specific cautions
This is documentation-based research for ONLYOFFICE Spreadsheet Editor, not a general Excel guide. The current function catalogue lists the function under Engineering; the English Insert Functions instructions show formulas beginning with = and (in their example grammar) comma-separated arguments. The ONLYOFFICE Advanced Settings help documents selectable formula languages and regional options. In other language/region setups, verify the localized function label, argument separator and decimal settings in the editor before pasting the English formula; no localized syntax was executed here.
Docs web vs Desktop Editors: ONLYOFFICE maintains Docs release notes separately from Desktop Editors release notes. The functions’ current online help is an unversioned reference, not a support matrix. Docs 10.0.0 is listed in its changelog dated 2026-10-10, while the Desktop changelog reviewed on 2026-10-13 has a separate version history. Neither checked changelog establishes a first-supported version for this specific base-conversion function. Accordingly, treat older Desktop, web installations and external file imports as not natively verified. No native execution, screenshot, runtime error capture, or edition-to-edition compatibility testing was performed for this manuscript.
Related official functions and further reading
The following links lead to official vendor references checked on 2026-10-13 UTC.
- OCT2DEC — ONLYOFFICE official reference — compare alternative input/output bases and formula argument order.
- HEX2OCT — ONLYOFFICE official reference — compare alternative input/output bases and formula argument order.
- HEX2DEC — ONLYOFFICE official reference — compare alternative input/output bases and formula argument order.
- ONLYOFFICE Insert Functions catalogue and English entry instructions — official category and manual formula-entry guidance.
- ONLYOFFICE Advanced Spreadsheet Settings — formula language, region and separator options.
- ONLYOFFICE Docs release history and Desktop Editors release history — separate platform histories, not function-by-function first-release evidence.
Verification and limitations
| Check | Status |
|---|---|
Official OCT2HEX syntax, argument order and documented default |
Documentation-checked, 2026-10-13 UTC |
| Official error/length behavior | Documentation-checked only for the rules stated above |
| Independent exact-integer examples | Validated with a separate calculation, not native ONLYOFFICE |
| ALL native Desktop/web execution tests | Not performed |
| Locale-specific syntax, exact runtime error captures, signed limit behavior | Unverified |
| Old release capability and first-supported web/Desktop edition | Not established |
For any native compatibility check, record the edition, version, operating system/browser, formula language, region, source-cell type and actual observed output.