RIGHTB
Supported, behaves as documentedCategory: Text · Last tested 2026-09-01
Real compatibility results for the RIGHTB function: executed in Excel for the web, Google Sheets and LibreOffice Calc, with desktop Excel behavior from Microsoft’s official documentation (we do not run desktop Excel — Excel for the web is a different application and is executed separately). Syntax and links to that documentation are below.
Support matrix
| Engine | Documented | Live-tested | Verdict |
|---|---|---|---|
| Excel (desktop) | Yes | No — documented only | n/a |
| Excel for the web | — | Yes (recalc, 2026-09-01) | Supported, behaves as documented |
| Google Sheets | Yes | Yes (Drive import, 2026-08-31) | Supported, behaves as documented |
| LibreOffice Calc | Yes | Yes (25.8.7.3, 2026-08-31) | Supported, behaves as documented |
LibreOffice version history
We executed the same test cases under each LibreOffice release to show exactly when RIGHTB’s support changed — not documentation claims, real results.
| LibreOffice version | Verdict | Tested |
|---|---|---|
| 24.2.0.3 | Supported, behaves as documented | 2026-08-31 |
| 24.8.7.2 | Supported, behaves as documented | 2026-08-31 |
| 25.2.0.3 | Supported, behaves as documented | 2026-08-31 |
| 25.8.7.3 | Supported, behaves as documented | 2026-08-31 |
Executed test cases
Excel for the web (executed 2026-09-01 via OneDrive recalculation)
These values come from Excel for the web, not from desktop Excel. They are two different implementations of the calculation engine, and this run measured only the web one: the corpus was uploaded to OneDrive as .xlsx, recalculated by Excel for the web on open, and downloaded again for readback. Excel for the web is a rolling service with no pinnable version, so the run is identified by its date. Where a value here disagrees with the Expected column — which is Microsoft’s documentation of the desktop product — we cannot tell you whether the web engine diverges from the desktop one or the documentation is wrong about both, because we do not run desktop Excel.
| Formula | Description | Result | Expected | Verdict |
|---|---|---|---|---|
| =RIGHTB(A2,5) | Microsoft's documented RIGHT example, on ASCII where bytes are characters | Price | PriceProvenanceThe RIGHT page publishes =RIGHT(A2,5) = Price for A2 = "Sale Price" ("Last 5 characters of the first string"). "Sale Price" is pure ASCII, so five bytes from the right are five characters from the right and RIGHTB must return the same string. RIGHTB HAS NO PAGE OF ITS OWN: it is documented on the combined RIGHT, RIGHTB page, whose only mention of it is the Important box -- "The RIGHTB function is deprecated. RIGHT now supports Unicode surrogates via the Compatibility Version, Version 2." Microsoft's page was re-read live on 2026-08-31 at https://support.microsoft.com/en-us/excel/functions/right-rightb-functions-240267ee-9afa-4639-a02b-f19e1786cf2f (the /en-us/office/<name>-function-<guid> path was returning Microsoft's 'Sorry, the page you're looking for can't be found' body throughout this batch, and the working path serves an 87 KB stub about half the time, so pages were fetched with retries until the payload exceeded 150 KB). |
Matched |
| =RIGHTB(A3) | Microsoft's second documented row: the argument omitted | r | rProvenanceThe RIGHT page publishes =RIGHT(A3) = r for A3 = "Stock Number" ("Last character of the second string") and documents the rule: "If num_chars is omitted, it is assumed to be 1." One byte of ASCII is one character, so RIGHTB with no count returns the final "r". |
Matched |
| =RIGHTB(A3,99) | A count larger than the text, which the page says returns everything | Stock Number | Stock NumberProvenanceThe RIGHT page documents: "If num_chars is greater than the length of text, RIGHT returns all of text." No padding, no error -- "Stock Number" is twelve ASCII bytes, so ninety-nine bytes returns the whole string. |
Matched |
| =RIGHTB(A3,0) | A count of zero, which is inside the documented range | ProvenanceThe RIGHT page documents: "Num_chars must be greater than or equal to zero." Zero is inside that range, so it must produce a result rather than an error, and zero bytes of text is the empty string. NOTE ON READ-BACK: a formula returning "" round-trips through .xlsx as a cell with no cached value at all, which openpyxl reads back as None; harness/corpus.py treats an expected "" as satisfied by a read-back None for exactly this reason, and the raw None is still recorded in the results file. |
Matched | |
| =RIGHTB(A3,-1) | A negative count, which is outside the documented range | #VALUE! | #VALUE!ProvenanceThe RIGHT page documents: "Num_chars must be greater than or equal to zero." A negative count is outside that range; #VALUE! is Excel's error for an argument of the wrong kind, and the sibling MID/MIDB page states it explicitly for its own negative-count case ("If num_chars is negative, MID returns the #VALUE! error value"), so the same code is asserted for the same condition here -- the same reading batch E's LEFTB file used. |
Matched |
| =RIGHTB("ABC",2) | Full-width (double-byte) characters, where byte and character counting diverge | BC | ProvenanceDELIBERATELY ASSERTS NOTHING, for the reason given in the LEFTB, MIDB and REPLACEB files: byte counting in the B functions historically applied only when the default language was a DBCS language, this harness runs under en_US.UTF-8, and Microsoft's current page documents nothing about REPLACEB/RIGHTB beyond their deprecation. Two bytes from the right is the last full-width character under DBCS rules and the last two characters otherwise; the case records what each engine returns rather than scoring it. |
Ran OK |
Google Sheets (executed 2026-08-31 via Drive import)
Google Sheets is a rolling service with no pinnable version, so this run is identified by its date. The corpus was imported to Drive as .xlsx, recalculated by Sheets, and exported back for readback.
| Formula | Description | Result | Expected | Verdict |
|---|---|---|---|---|
| =RIGHTB(A2,5) | Microsoft's documented RIGHT example, on ASCII where bytes are characters | Price | PriceProvenanceThe RIGHT page publishes =RIGHT(A2,5) = Price for A2 = "Sale Price" ("Last 5 characters of the first string"). "Sale Price" is pure ASCII, so five bytes from the right are five characters from the right and RIGHTB must return the same string. RIGHTB HAS NO PAGE OF ITS OWN: it is documented on the combined RIGHT, RIGHTB page, whose only mention of it is the Important box -- "The RIGHTB function is deprecated. RIGHT now supports Unicode surrogates via the Compatibility Version, Version 2." Microsoft's page was re-read live on 2026-08-31 at https://support.microsoft.com/en-us/excel/functions/right-rightb-functions-240267ee-9afa-4639-a02b-f19e1786cf2f (the /en-us/office/<name>-function-<guid> path was returning Microsoft's 'Sorry, the page you're looking for can't be found' body throughout this batch, and the working path serves an 87 KB stub about half the time, so pages were fetched with retries until the payload exceeded 150 KB). |
Matched |
| =RIGHTB(A3) | Microsoft's second documented row: the argument omitted | r | rProvenanceThe RIGHT page publishes =RIGHT(A3) = r for A3 = "Stock Number" ("Last character of the second string") and documents the rule: "If num_chars is omitted, it is assumed to be 1." One byte of ASCII is one character, so RIGHTB with no count returns the final "r". |
Matched |
| =RIGHTB(A3,99) | A count larger than the text, which the page says returns everything | Stock Number | Stock NumberProvenanceThe RIGHT page documents: "If num_chars is greater than the length of text, RIGHT returns all of text." No padding, no error -- "Stock Number" is twelve ASCII bytes, so ninety-nine bytes returns the whole string. |
Matched |
| =RIGHTB(A3,0) | A count of zero, which is inside the documented range | ProvenanceThe RIGHT page documents: "Num_chars must be greater than or equal to zero." Zero is inside that range, so it must produce a result rather than an error, and zero bytes of text is the empty string. NOTE ON READ-BACK: a formula returning "" round-trips through .xlsx as a cell with no cached value at all, which openpyxl reads back as None; harness/corpus.py treats an expected "" as satisfied by a read-back None for exactly this reason, and the raw None is still recorded in the results file. |
Matched | |
| =RIGHTB(A3,-1) | A negative count, which is outside the documented range | #VALUE! | #VALUE!ProvenanceThe RIGHT page documents: "Num_chars must be greater than or equal to zero." A negative count is outside that range; #VALUE! is Excel's error for an argument of the wrong kind, and the sibling MID/MIDB page states it explicitly for its own negative-count case ("If num_chars is negative, MID returns the #VALUE! error value"), so the same code is asserted for the same condition here -- the same reading batch E's LEFTB file used. |
Matched |
| =RIGHTB("ABC",2) | Full-width (double-byte) characters, where byte and character counting diverge | C | ProvenanceDELIBERATELY ASSERTS NOTHING, for the reason given in the LEFTB, MIDB and REPLACEB files: byte counting in the B functions historically applied only when the default language was a DBCS language, this harness runs under en_US.UTF-8, and Microsoft's current page documents nothing about REPLACEB/RIGHTB beyond their deprecation. Two bytes from the right is the last full-width character under DBCS rules and the last two characters otherwise; the case records what each engine returns rather than scoring it. |
Ran OK |
LibreOffice Calc 25.8.7.3 (tested 2026-08-31)
| Formula | Description | Result | Expected | Verdict |
|---|---|---|---|---|
| =RIGHTB(A2,5) | Microsoft's documented RIGHT example, on ASCII where bytes are characters | Price | PriceProvenanceThe RIGHT page publishes =RIGHT(A2,5) = Price for A2 = "Sale Price" ("Last 5 characters of the first string"). "Sale Price" is pure ASCII, so five bytes from the right are five characters from the right and RIGHTB must return the same string. RIGHTB HAS NO PAGE OF ITS OWN: it is documented on the combined RIGHT, RIGHTB page, whose only mention of it is the Important box -- "The RIGHTB function is deprecated. RIGHT now supports Unicode surrogates via the Compatibility Version, Version 2." Microsoft's page was re-read live on 2026-08-31 at https://support.microsoft.com/en-us/excel/functions/right-rightb-functions-240267ee-9afa-4639-a02b-f19e1786cf2f (the /en-us/office/<name>-function-<guid> path was returning Microsoft's 'Sorry, the page you're looking for can't be found' body throughout this batch, and the working path serves an 87 KB stub about half the time, so pages were fetched with retries until the payload exceeded 150 KB). |
Matched |
| =RIGHTB(A3) | Microsoft's second documented row: the argument omitted | r | rProvenanceThe RIGHT page publishes =RIGHT(A3) = r for A3 = "Stock Number" ("Last character of the second string") and documents the rule: "If num_chars is omitted, it is assumed to be 1." One byte of ASCII is one character, so RIGHTB with no count returns the final "r". |
Matched |
| =RIGHTB(A3,99) | A count larger than the text, which the page says returns everything | Stock Number | Stock NumberProvenanceThe RIGHT page documents: "If num_chars is greater than the length of text, RIGHT returns all of text." No padding, no error -- "Stock Number" is twelve ASCII bytes, so ninety-nine bytes returns the whole string. |
Matched |
| =RIGHTB(A3,0) | A count of zero, which is inside the documented range | ProvenanceThe RIGHT page documents: "Num_chars must be greater than or equal to zero." Zero is inside that range, so it must produce a result rather than an error, and zero bytes of text is the empty string. NOTE ON READ-BACK: a formula returning "" round-trips through .xlsx as a cell with no cached value at all, which openpyxl reads back as None; harness/corpus.py treats an expected "" as satisfied by a read-back None for exactly this reason, and the raw None is still recorded in the results file. |
Matched | |
| =RIGHTB(A3,-1) | A negative count, which is outside the documented range | #VALUE! | #VALUE!ProvenanceThe RIGHT page documents: "Num_chars must be greater than or equal to zero." A negative count is outside that range; #VALUE! is Excel's error for an argument of the wrong kind, and the sibling MID/MIDB page states it explicitly for its own negative-count case ("If num_chars is negative, MID returns the #VALUE! error value"), so the same code is asserted for the same condition here -- the same reading batch E's LEFTB file used. |
Matched |
| =RIGHTB("ABC",2) | Full-width (double-byte) characters, where byte and character counting diverge | C | ProvenanceDELIBERATELY ASSERTS NOTHING, for the reason given in the LEFTB, MIDB and REPLACEB files: byte counting in the B functions historically applied only when the default language was a DBCS language, this harness runs under en_US.UTF-8, and Microsoft's current page documents nothing about REPLACEB/RIGHTB beyond their deprecation. Two bytes from the right is the last full-width character under DBCS rules and the last two characters otherwise; the case records what each engine returns rather than scoring it. |
Ran OK |
Docs & syntax
- Excel (desktop): official documentation
- Google Sheets: official documentation
- LibreOffice Calc: official documentation
Where RIGHTB behaves differently
- LENB and CJK text: 4 in Sheets and LibreOffice, 2 in Excel for the web
Microsoft's archived LEN/LENB page says LENB counts 2 bytes per character only under a DBCS default language, otherwise 1. Executed under a non-DBCS locale, =LENB("日本") returned 4 in Google Sheets and all four LibreOffice builds - but 2, the documented answer, in Excel for the web. Desktop Excel stays documentation only.