REPLACEB
Supported, behaves as documentedCategory: Text · Last tested 2026-09-01
Real compatibility results for the REPLACEB 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 | No | 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 REPLACEB’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 |
|---|---|---|---|---|
| =REPLACEB(A2,6,5,"*") | Microsoft's documented REPLACE example, on pure ASCII where bytes are characters | abcde*k | abcde*kProvenanceThe REPLACE page publishes =REPLACE(A2,6,5,"*") = abcde*k for A2 = "abcdefghijk": "Replaces five characters in abcdefghijk with a single * character, starting with the sixth character (f)." "abcdefghijk" is pure ASCII, so its bytes and its characters are the same things and REPLACEB must return the same string. REPLACEB HAS NO PAGE OF ITS OWN: Microsoft documents it on the combined REPLACE, REPLACEB page, which now carries only an Important box about it -- "The REPLACEB function is deprecated. In workbooks set to Compatibility Version 2, REPLACE has improved behavior with Surrogate Pairs, counting them as one character instead of two. Variation Selectors (commonly used with emojis) will still be counted as separate characters." Every worked example on that page is written with REPLACE, which is why the ASCII cases here are the honest way to test REPLACEB against documented behaviour. Microsoft's page was re-read live on 2026-08-31 at https://support.microsoft.com/en-us/excel/functions/replace-replaceb-functions-8d799074-2425-4a8a-84bc-82472868878a (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 |
| =REPLACEB(A3,3,2,"10") | Microsoft's second documented row: replacing the last two digits of a year | 2010 | 2010ProvenanceThe REPLACE page publishes =REPLACE(A3,3,2,"10") = 2010 for A3 = 2009: "Replaces the last two digits (09) of 2009 with 10." Note the source cell holds the NUMBER 2009, not the text "2009" -- Microsoft's example data is a number -- so this case also exercises the implicit number-to-text conversion. The result is the four-character string "2010", not the number 2010. |
Matched |
| =REPLACEB(A4,1,3,"@") | Microsoft's third documented row | @456 | @456ProvenanceThe REPLACE page publishes =REPLACE(A4,1,3,"@") = @456 for A4 = 123456: "Replaces the first three characters of 123456 with a single @ character." Start position 1 is the first byte, which is the boundary case for a one-based index. |
Matched |
| =REPLACEB("abcdef",3,0,"XY") | A replacement of zero bytes, which inserts rather than replaces | abXYcdef | abXYcdefProvenanceReplacing zero bytes at position 3 removes nothing and inserts "XY" before the third byte, giving "abXYcdef". The behaviour follows directly from the documented meaning of the arguments -- start_num is where to begin and num_chars/num_bytes is how many to take out -- and it is worth asserting because an off-by-one in the insertion point is invisible in every case where something is actually replaced. |
Matched |
| =REPLACEB("ABC",1,2,"x") | Full-width (double-byte) characters, where byte and character counting diverge | xC | ProvenanceDELIBERATELY ASSERTS NOTHING. This is the one thing REPLACEB does that REPLACE does not, and it is also the one thing Microsoft no longer documents: the combined page's only mention of REPLACEB is that it is deprecated. Historically the B functions counted BYTES only when the default language was a DBCS language (Japanese, Chinese, Korean) and behaved exactly like their non-B siblings otherwise -- so under this harness's en_US.UTF-8 environment the two readings give different answers (two bytes is the first full-width character under DBCS rules, the first TWO characters otherwise) and neither can be called wrong without knowing which rule the engine applied. The case therefore records what each engine returns instead of scoring it, exactly as the LEFTB and MIDB files from batch E do. |
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 |
|---|---|---|---|---|
| =REPLACEB(A2,6,5,"*") | Microsoft's documented REPLACE example, on pure ASCII where bytes are characters | abcde*k | abcde*kProvenanceThe REPLACE page publishes =REPLACE(A2,6,5,"*") = abcde*k for A2 = "abcdefghijk": "Replaces five characters in abcdefghijk with a single * character, starting with the sixth character (f)." "abcdefghijk" is pure ASCII, so its bytes and its characters are the same things and REPLACEB must return the same string. REPLACEB HAS NO PAGE OF ITS OWN: Microsoft documents it on the combined REPLACE, REPLACEB page, which now carries only an Important box about it -- "The REPLACEB function is deprecated. In workbooks set to Compatibility Version 2, REPLACE has improved behavior with Surrogate Pairs, counting them as one character instead of two. Variation Selectors (commonly used with emojis) will still be counted as separate characters." Every worked example on that page is written with REPLACE, which is why the ASCII cases here are the honest way to test REPLACEB against documented behaviour. Microsoft's page was re-read live on 2026-08-31 at https://support.microsoft.com/en-us/excel/functions/replace-replaceb-functions-8d799074-2425-4a8a-84bc-82472868878a (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 |
| =REPLACEB(A3,3,2,"10") | Microsoft's second documented row: replacing the last two digits of a year | 2010 | 2010ProvenanceThe REPLACE page publishes =REPLACE(A3,3,2,"10") = 2010 for A3 = 2009: "Replaces the last two digits (09) of 2009 with 10." Note the source cell holds the NUMBER 2009, not the text "2009" -- Microsoft's example data is a number -- so this case also exercises the implicit number-to-text conversion. The result is the four-character string "2010", not the number 2010. |
Matched |
| =REPLACEB(A4,1,3,"@") | Microsoft's third documented row | @456 | @456ProvenanceThe REPLACE page publishes =REPLACE(A4,1,3,"@") = @456 for A4 = 123456: "Replaces the first three characters of 123456 with a single @ character." Start position 1 is the first byte, which is the boundary case for a one-based index. |
Matched |
| =REPLACEB("abcdef",3,0,"XY") | A replacement of zero bytes, which inserts rather than replaces | abXYcdef | abXYcdefProvenanceReplacing zero bytes at position 3 removes nothing and inserts "XY" before the third byte, giving "abXYcdef". The behaviour follows directly from the documented meaning of the arguments -- start_num is where to begin and num_chars/num_bytes is how many to take out -- and it is worth asserting because an off-by-one in the insertion point is invisible in every case where something is actually replaced. |
Matched |
| =REPLACEB("ABC",1,2,"x") | Full-width (double-byte) characters, where byte and character counting diverge | xBC | ProvenanceDELIBERATELY ASSERTS NOTHING. This is the one thing REPLACEB does that REPLACE does not, and it is also the one thing Microsoft no longer documents: the combined page's only mention of REPLACEB is that it is deprecated. Historically the B functions counted BYTES only when the default language was a DBCS language (Japanese, Chinese, Korean) and behaved exactly like their non-B siblings otherwise -- so under this harness's en_US.UTF-8 environment the two readings give different answers (two bytes is the first full-width character under DBCS rules, the first TWO characters otherwise) and neither can be called wrong without knowing which rule the engine applied. The case therefore records what each engine returns instead of scoring it, exactly as the LEFTB and MIDB files from batch E do. |
Ran OK |
LibreOffice Calc 25.8.7.3 (tested 2026-08-31)
| Formula | Description | Result | Expected | Verdict |
|---|---|---|---|---|
| =REPLACEB(A2,6,5,"*") | Microsoft's documented REPLACE example, on pure ASCII where bytes are characters | abcde*k | abcde*kProvenanceThe REPLACE page publishes =REPLACE(A2,6,5,"*") = abcde*k for A2 = "abcdefghijk": "Replaces five characters in abcdefghijk with a single * character, starting with the sixth character (f)." "abcdefghijk" is pure ASCII, so its bytes and its characters are the same things and REPLACEB must return the same string. REPLACEB HAS NO PAGE OF ITS OWN: Microsoft documents it on the combined REPLACE, REPLACEB page, which now carries only an Important box about it -- "The REPLACEB function is deprecated. In workbooks set to Compatibility Version 2, REPLACE has improved behavior with Surrogate Pairs, counting them as one character instead of two. Variation Selectors (commonly used with emojis) will still be counted as separate characters." Every worked example on that page is written with REPLACE, which is why the ASCII cases here are the honest way to test REPLACEB against documented behaviour. Microsoft's page was re-read live on 2026-08-31 at https://support.microsoft.com/en-us/excel/functions/replace-replaceb-functions-8d799074-2425-4a8a-84bc-82472868878a (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 |
| =REPLACEB(A3,3,2,"10") | Microsoft's second documented row: replacing the last two digits of a year | 2010 | 2010ProvenanceThe REPLACE page publishes =REPLACE(A3,3,2,"10") = 2010 for A3 = 2009: "Replaces the last two digits (09) of 2009 with 10." Note the source cell holds the NUMBER 2009, not the text "2009" -- Microsoft's example data is a number -- so this case also exercises the implicit number-to-text conversion. The result is the four-character string "2010", not the number 2010. |
Matched |
| =REPLACEB(A4,1,3,"@") | Microsoft's third documented row | @456 | @456ProvenanceThe REPLACE page publishes =REPLACE(A4,1,3,"@") = @456 for A4 = 123456: "Replaces the first three characters of 123456 with a single @ character." Start position 1 is the first byte, which is the boundary case for a one-based index. |
Matched |
| =REPLACEB("abcdef",3,0,"XY") | A replacement of zero bytes, which inserts rather than replaces | abXYcdef | abXYcdefProvenanceReplacing zero bytes at position 3 removes nothing and inserts "XY" before the third byte, giving "abXYcdef". The behaviour follows directly from the documented meaning of the arguments -- start_num is where to begin and num_chars/num_bytes is how many to take out -- and it is worth asserting because an off-by-one in the insertion point is invisible in every case where something is actually replaced. |
Matched |
| =REPLACEB("ABC",1,2,"x") | Full-width (double-byte) characters, where byte and character counting diverge | xBC | ProvenanceDELIBERATELY ASSERTS NOTHING. This is the one thing REPLACEB does that REPLACE does not, and it is also the one thing Microsoft no longer documents: the combined page's only mention of REPLACEB is that it is deprecated. Historically the B functions counted BYTES only when the default language was a DBCS language (Japanese, Chinese, Korean) and behaved exactly like their non-B siblings otherwise -- so under this harness's en_US.UTF-8 environment the two readings give different answers (two bytes is the first full-width character under DBCS rules, the first TWO characters otherwise) and neither can be called wrong without knowing which rule the engine applied. The case therefore records what each engine returns instead of scoring it, exactly as the LEFTB and MIDB files from batch E do. |
Ran OK |
Docs & syntax
- Excel (desktop): official documentation
- Google Sheets: official documentation
Where REPLACEB 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.