← All functions

MIDB

Quirk found

Category: Text · Last tested 2026-09-01

Real compatibility results for the MIDB 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

EngineDocumentedLive-testedVerdict
Excel (desktop)Yes No — documented only n/a
Excel for the web— Yes (recalc, 2026-09-01) Supported, behaves as documented
Google SheetsYes Yes (Drive import, 2026-08-31) Quirk found
LibreOffice CalcYes 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 MIDB’s support changed — not documentation claims, real results.

LibreOffice versionVerdictTested
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

Why isn’t MIDB working in Google Sheets?

MIDB runs in Google Sheets, but our executed cases show it does not match Excel’s documented behavior on every input (the failing cases are listed on this page). If a formula that behaves one way in Excel gives you a different answer in Sheets, compare your usage against those cases before assuming your data is wrong.

Discovered quirks

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.

FormulaDescriptionResultExpectedVerdict
=MIDB(A2,1,5) Microsoft's first worked example on the MID page, run through the byte-counting spelling Fluid Fluid
Provenance

The MID page publishes =MID(A2,1,5) = Fluid for A2 = "Fluid Flow", described as "Returns 5 characters from the string in A2, starting at the 1st character". "Fluid Flow" is pure ASCII, so bytes and characters coincide. MIDB HAS NO PAGE OF ITS OWN ANY MORE. Microsoft's MID page -- the page that historically documented MID and MIDB together -- now carries only an Important box reading "The MIDB function is deprecated", and every worked example and argument rule on it is written for MID. MIDB is still listed as an Excel function, so it is in scope for this corpus, but the only documented behaviour available to assert is the behaviour it shares with MID: for text in which every character occupies one byte, a byte count and a character count are the same number, so MIDB must return what MID returns. Those are the cases asserted here, each traced to a specific sentence on the MID page. The genuinely byte-specific behaviour -- what happens to double-byte characters, which historically depended on whether the default language was a DBCS language -- is carried as a probe below rather than asserted, because Microsoft no longer publishes a rule for it.

Matched
=MIDB(A2,7,20) Microsoft's second worked example: a count that overruns the end of the string Flow Flow
Provenance

The MID page publishes =MID(A2,7,20) = Flow and explains it: "Because the number of characters to return (20) is greater than the length of the string (10), all characters, beginning with the 7th, are returned. No empty characters (spaces) are added to the end." The documented rule is also stated in the arguments section: "If start_num is less than the length of text, but start_num plus num_chars exceeds the length of text, MID returns the characters up to the end of text." MIDB HAS NO PAGE OF ITS OWN ANY MORE. Microsoft's MID page -- the page that historically documented MID and MIDB together -- now carries only an Important box reading "The MIDB function is deprecated", and every worked example and argument rule on it is written for MID. MIDB is still listed as an Excel function, so it is in scope for this corpus, but the only documented behaviour available to assert is the behaviour it shares with MID: for text in which every character occupies one byte, a byte count and a character count are the same number, so MIDB must return what MID returns. Those are the cases asserted here, each traced to a specific sentence on the MID page. The genuinely byte-specific behaviour -- what happens to double-byte characters, which historically depended on whether the default language was a DBCS language -- is carried as a probe below rather than asserted, because Microsoft no longer publishes a rule for it.

Matched
=MIDB(A2,20,5) Microsoft's third worked example: a start position past the end of the string
Provenance

The MID page publishes this example with an empty Result cell and the explanation "Because the starting point is greater than the length (10) of the string, empty text is returned", matching the documented rule "If start_num is greater than the length of text, MID returns \"\" (empty text)". Empty text, not an error and not a space. MIDB HAS NO PAGE OF ITS OWN ANY MORE. Microsoft's MID page -- the page that historically documented MID and MIDB together -- now carries only an Important box reading "The MIDB function is deprecated", and every worked example and argument rule on it is written for MID. MIDB is still listed as an Excel function, so it is in scope for this corpus, but the only documented behaviour available to assert is the behaviour it shares with MID: for text in which every character occupies one byte, a byte count and a character count are the same number, so MIDB must return what MID returns. Those are the cases asserted here, each traced to a specific sentence on the MID page. The genuinely byte-specific behaviour -- what happens to double-byte characters, which historically depended on whether the default language was a DBCS language -- is carried as a probe below rather than asserted, because Microsoft no longer publishes a rule for it.

Matched
=MIDB(A2,0,5) A start position of zero, which the page excludes #VALUE! #VALUE!
Provenance

The MID page documents: "If start_num is less than 1, MID returns the #VALUE! error value." Positions are 1-based -- "The first character in text has start_num 1" -- so 0 is outside the range rather than a synonym for the beginning. MIDB HAS NO PAGE OF ITS OWN ANY MORE. Microsoft's MID page -- the page that historically documented MID and MIDB together -- now carries only an Important box reading "The MIDB function is deprecated", and every worked example and argument rule on it is written for MID. MIDB is still listed as an Excel function, so it is in scope for this corpus, but the only documented behaviour available to assert is the behaviour it shares with MID: for text in which every character occupies one byte, a byte count and a character count are the same number, so MIDB must return what MID returns. Those are the cases asserted here, each traced to a specific sentence on the MID page. The genuinely byte-specific behaviour -- what happens to double-byte characters, which historically depended on whether the default language was a DBCS language -- is carried as a probe below rather than asserted, because Microsoft no longer publishes a rule for it.

Matched
=MIDB(A2,1,-1) A negative count, which the page also excludes #VALUE! #VALUE!
Provenance

The MID page documents: "If num_chars is negative, MID returns the #VALUE! error value." Asserted separately from the start_num exclusion because they are two different documented sentences about two different arguments. MIDB HAS NO PAGE OF ITS OWN ANY MORE. Microsoft's MID page -- the page that historically documented MID and MIDB together -- now carries only an Important box reading "The MIDB function is deprecated", and every worked example and argument rule on it is written for MID. MIDB is still listed as an Excel function, so it is in scope for this corpus, but the only documented behaviour available to assert is the behaviour it shares with MID: for text in which every character occupies one byte, a byte count and a character count are the same number, so MIDB must return what MID returns. Those are the cases asserted here, each traced to a specific sentence on the MID page. The genuinely byte-specific behaviour -- what happens to double-byte characters, which historically depended on whether the default language was a DBCS language -- is carried as a probe below rather than asserted, because Microsoft no longer publishes a rule for it.

Matched
=MIDB("EXCEL",2,2) PROBE: a byte window that falls in the MIDDLE of a double-byte character XC
Provenance

The sharpest question a byte-counting text function can be asked, and one Microsoft no longer publishes a rule for: bytes 2 and 3 of a string of double-byte characters are the second half of the first character and the first half of the second, so a byte-counting implementation cannot return whole characters at all. Under a character-counting reading the answer would simply be "XC". No expected value is invented. FOR THE RECORD, all four LibreOffice builds return two SPACE characters here -- the historical Excel behaviour for a split double-byte character, where each severed half becomes a space -- while MIDB("EXCEL",3,4) returns "XC", i.e. an odd-numbered byte offset lands cleanly on a character boundary. Both are consistent with genuine byte counting, and neither is consistent with the character-counting reading.

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.

FormulaDescriptionResultExpectedVerdict
=MIDB(A2,1,5) Microsoft's first worked example on the MID page, run through the byte-counting spelling Fluid Fluid
Provenance

The MID page publishes =MID(A2,1,5) = Fluid for A2 = "Fluid Flow", described as "Returns 5 characters from the string in A2, starting at the 1st character". "Fluid Flow" is pure ASCII, so bytes and characters coincide. MIDB HAS NO PAGE OF ITS OWN ANY MORE. Microsoft's MID page -- the page that historically documented MID and MIDB together -- now carries only an Important box reading "The MIDB function is deprecated", and every worked example and argument rule on it is written for MID. MIDB is still listed as an Excel function, so it is in scope for this corpus, but the only documented behaviour available to assert is the behaviour it shares with MID: for text in which every character occupies one byte, a byte count and a character count are the same number, so MIDB must return what MID returns. Those are the cases asserted here, each traced to a specific sentence on the MID page. The genuinely byte-specific behaviour -- what happens to double-byte characters, which historically depended on whether the default language was a DBCS language -- is carried as a probe below rather than asserted, because Microsoft no longer publishes a rule for it.

Matched
=MIDB(A2,7,20) Microsoft's second worked example: a count that overruns the end of the string Flow Flow
Provenance

The MID page publishes =MID(A2,7,20) = Flow and explains it: "Because the number of characters to return (20) is greater than the length of the string (10), all characters, beginning with the 7th, are returned. No empty characters (spaces) are added to the end." The documented rule is also stated in the arguments section: "If start_num is less than the length of text, but start_num plus num_chars exceeds the length of text, MID returns the characters up to the end of text." MIDB HAS NO PAGE OF ITS OWN ANY MORE. Microsoft's MID page -- the page that historically documented MID and MIDB together -- now carries only an Important box reading "The MIDB function is deprecated", and every worked example and argument rule on it is written for MID. MIDB is still listed as an Excel function, so it is in scope for this corpus, but the only documented behaviour available to assert is the behaviour it shares with MID: for text in which every character occupies one byte, a byte count and a character count are the same number, so MIDB must return what MID returns. Those are the cases asserted here, each traced to a specific sentence on the MID page. The genuinely byte-specific behaviour -- what happens to double-byte characters, which historically depended on whether the default language was a DBCS language -- is carried as a probe below rather than asserted, because Microsoft no longer publishes a rule for it.

Matched
=MIDB(A2,20,5) Microsoft's third worked example: a start position past the end of the string
Provenance

The MID page publishes this example with an empty Result cell and the explanation "Because the starting point is greater than the length (10) of the string, empty text is returned", matching the documented rule "If start_num is greater than the length of text, MID returns \"\" (empty text)". Empty text, not an error and not a space. MIDB HAS NO PAGE OF ITS OWN ANY MORE. Microsoft's MID page -- the page that historically documented MID and MIDB together -- now carries only an Important box reading "The MIDB function is deprecated", and every worked example and argument rule on it is written for MID. MIDB is still listed as an Excel function, so it is in scope for this corpus, but the only documented behaviour available to assert is the behaviour it shares with MID: for text in which every character occupies one byte, a byte count and a character count are the same number, so MIDB must return what MID returns. Those are the cases asserted here, each traced to a specific sentence on the MID page. The genuinely byte-specific behaviour -- what happens to double-byte characters, which historically depended on whether the default language was a DBCS language -- is carried as a probe below rather than asserted, because Microsoft no longer publishes a rule for it.

Matched
=MIDB(A2,0,5) A start position of zero, which the page excludes #NUM! #VALUE!
Provenance

The MID page documents: "If start_num is less than 1, MID returns the #VALUE! error value." Positions are 1-based -- "The first character in text has start_num 1" -- so 0 is outside the range rather than a synonym for the beginning. MIDB HAS NO PAGE OF ITS OWN ANY MORE. Microsoft's MID page -- the page that historically documented MID and MIDB together -- now carries only an Important box reading "The MIDB function is deprecated", and every worked example and argument rule on it is written for MID. MIDB is still listed as an Excel function, so it is in scope for this corpus, but the only documented behaviour available to assert is the behaviour it shares with MID: for text in which every character occupies one byte, a byte count and a character count are the same number, so MIDB must return what MID returns. Those are the cases asserted here, each traced to a specific sentence on the MID page. The genuinely byte-specific behaviour -- what happens to double-byte characters, which historically depended on whether the default language was a DBCS language -- is carried as a probe below rather than asserted, because Microsoft no longer publishes a rule for it.

Mismatch
=MIDB(A2,1,-1) A negative count, which the page also excludes #VALUE! #VALUE!
Provenance

The MID page documents: "If num_chars is negative, MID returns the #VALUE! error value." Asserted separately from the start_num exclusion because they are two different documented sentences about two different arguments. MIDB HAS NO PAGE OF ITS OWN ANY MORE. Microsoft's MID page -- the page that historically documented MID and MIDB together -- now carries only an Important box reading "The MIDB function is deprecated", and every worked example and argument rule on it is written for MID. MIDB is still listed as an Excel function, so it is in scope for this corpus, but the only documented behaviour available to assert is the behaviour it shares with MID: for text in which every character occupies one byte, a byte count and a character count are the same number, so MIDB must return what MID returns. Those are the cases asserted here, each traced to a specific sentence on the MID page. The genuinely byte-specific behaviour -- what happens to double-byte characters, which historically depended on whether the default language was a DBCS language -- is carried as a probe below rather than asserted, because Microsoft no longer publishes a rule for it.

Matched
=MIDB("EXCEL",2,2) PROBE: a byte window that falls in the MIDDLE of a double-byte character X
Provenance

The sharpest question a byte-counting text function can be asked, and one Microsoft no longer publishes a rule for: bytes 2 and 3 of a string of double-byte characters are the second half of the first character and the first half of the second, so a byte-counting implementation cannot return whole characters at all. Under a character-counting reading the answer would simply be "XC". No expected value is invented. FOR THE RECORD, all four LibreOffice builds return two SPACE characters here -- the historical Excel behaviour for a split double-byte character, where each severed half becomes a space -- while MIDB("EXCEL",3,4) returns "XC", i.e. an odd-numbered byte offset lands cleanly on a character boundary. Both are consistent with genuine byte counting, and neither is consistent with the character-counting reading.

Ran OK

LibreOffice Calc 25.8.7.3 (tested 2026-08-31)

FormulaDescriptionResultExpectedVerdict
=MIDB(A2,1,5) Microsoft's first worked example on the MID page, run through the byte-counting spelling Fluid Fluid
Provenance

The MID page publishes =MID(A2,1,5) = Fluid for A2 = "Fluid Flow", described as "Returns 5 characters from the string in A2, starting at the 1st character". "Fluid Flow" is pure ASCII, so bytes and characters coincide. MIDB HAS NO PAGE OF ITS OWN ANY MORE. Microsoft's MID page -- the page that historically documented MID and MIDB together -- now carries only an Important box reading "The MIDB function is deprecated", and every worked example and argument rule on it is written for MID. MIDB is still listed as an Excel function, so it is in scope for this corpus, but the only documented behaviour available to assert is the behaviour it shares with MID: for text in which every character occupies one byte, a byte count and a character count are the same number, so MIDB must return what MID returns. Those are the cases asserted here, each traced to a specific sentence on the MID page. The genuinely byte-specific behaviour -- what happens to double-byte characters, which historically depended on whether the default language was a DBCS language -- is carried as a probe below rather than asserted, because Microsoft no longer publishes a rule for it.

Matched
=MIDB(A2,7,20) Microsoft's second worked example: a count that overruns the end of the string Flow Flow
Provenance

The MID page publishes =MID(A2,7,20) = Flow and explains it: "Because the number of characters to return (20) is greater than the length of the string (10), all characters, beginning with the 7th, are returned. No empty characters (spaces) are added to the end." The documented rule is also stated in the arguments section: "If start_num is less than the length of text, but start_num plus num_chars exceeds the length of text, MID returns the characters up to the end of text." MIDB HAS NO PAGE OF ITS OWN ANY MORE. Microsoft's MID page -- the page that historically documented MID and MIDB together -- now carries only an Important box reading "The MIDB function is deprecated", and every worked example and argument rule on it is written for MID. MIDB is still listed as an Excel function, so it is in scope for this corpus, but the only documented behaviour available to assert is the behaviour it shares with MID: for text in which every character occupies one byte, a byte count and a character count are the same number, so MIDB must return what MID returns. Those are the cases asserted here, each traced to a specific sentence on the MID page. The genuinely byte-specific behaviour -- what happens to double-byte characters, which historically depended on whether the default language was a DBCS language -- is carried as a probe below rather than asserted, because Microsoft no longer publishes a rule for it.

Matched
=MIDB(A2,20,5) Microsoft's third worked example: a start position past the end of the string
Provenance

The MID page publishes this example with an empty Result cell and the explanation "Because the starting point is greater than the length (10) of the string, empty text is returned", matching the documented rule "If start_num is greater than the length of text, MID returns \"\" (empty text)". Empty text, not an error and not a space. MIDB HAS NO PAGE OF ITS OWN ANY MORE. Microsoft's MID page -- the page that historically documented MID and MIDB together -- now carries only an Important box reading "The MIDB function is deprecated", and every worked example and argument rule on it is written for MID. MIDB is still listed as an Excel function, so it is in scope for this corpus, but the only documented behaviour available to assert is the behaviour it shares with MID: for text in which every character occupies one byte, a byte count and a character count are the same number, so MIDB must return what MID returns. Those are the cases asserted here, each traced to a specific sentence on the MID page. The genuinely byte-specific behaviour -- what happens to double-byte characters, which historically depended on whether the default language was a DBCS language -- is carried as a probe below rather than asserted, because Microsoft no longer publishes a rule for it.

Matched
=MIDB(A2,0,5) A start position of zero, which the page excludes #VALUE! #VALUE!
Provenance

The MID page documents: "If start_num is less than 1, MID returns the #VALUE! error value." Positions are 1-based -- "The first character in text has start_num 1" -- so 0 is outside the range rather than a synonym for the beginning. MIDB HAS NO PAGE OF ITS OWN ANY MORE. Microsoft's MID page -- the page that historically documented MID and MIDB together -- now carries only an Important box reading "The MIDB function is deprecated", and every worked example and argument rule on it is written for MID. MIDB is still listed as an Excel function, so it is in scope for this corpus, but the only documented behaviour available to assert is the behaviour it shares with MID: for text in which every character occupies one byte, a byte count and a character count are the same number, so MIDB must return what MID returns. Those are the cases asserted here, each traced to a specific sentence on the MID page. The genuinely byte-specific behaviour -- what happens to double-byte characters, which historically depended on whether the default language was a DBCS language -- is carried as a probe below rather than asserted, because Microsoft no longer publishes a rule for it.

Matched
=MIDB(A2,1,-1) A negative count, which the page also excludes #VALUE! #VALUE!
Provenance

The MID page documents: "If num_chars is negative, MID returns the #VALUE! error value." Asserted separately from the start_num exclusion because they are two different documented sentences about two different arguments. MIDB HAS NO PAGE OF ITS OWN ANY MORE. Microsoft's MID page -- the page that historically documented MID and MIDB together -- now carries only an Important box reading "The MIDB function is deprecated", and every worked example and argument rule on it is written for MID. MIDB is still listed as an Excel function, so it is in scope for this corpus, but the only documented behaviour available to assert is the behaviour it shares with MID: for text in which every character occupies one byte, a byte count and a character count are the same number, so MIDB must return what MID returns. Those are the cases asserted here, each traced to a specific sentence on the MID page. The genuinely byte-specific behaviour -- what happens to double-byte characters, which historically depended on whether the default language was a DBCS language -- is carried as a probe below rather than asserted, because Microsoft no longer publishes a rule for it.

Matched
=MIDB("EXCEL",2,2) PROBE: a byte window that falls in the MIDDLE of a double-byte character U+0020U+0020
Provenance

The sharpest question a byte-counting text function can be asked, and one Microsoft no longer publishes a rule for: bytes 2 and 3 of a string of double-byte characters are the second half of the first character and the first half of the second, so a byte-counting implementation cannot return whole characters at all. Under a character-counting reading the answer would simply be "XC". No expected value is invented. FOR THE RECORD, all four LibreOffice builds return two SPACE characters here -- the historical Excel behaviour for a split double-byte character, where each severed half becomes a space -- while MIDB("EXCEL",3,4) returns "XC", i.e. an odd-numbered byte offset lands cleanly on a character boundary. Both are consistent with genuine byte counting, and neither is consistent with the character-counting reading.

Ran OK

Docs & syntax

Where MIDB behaves differently