MIDB

Returns a section of a string starting at a given character and up to a specified number of bytes. Learn more.

Video field
Text

The MIDB function in Google Sheets is used to extract a portion of a text string, starting at a specific character position, and for a given length in bytes.

This function is useful when working with multi-byte character encodings, such as UTF-8, where some characters may require more than one byte to represent.

The syntax of the MIDB function is as follows:

MIDB(string, startingat, extractlength_bytes)

string: This is the text string from which you want to extract a portion.

starting_at: It specifies the character position in the string where the extraction should begin. The first character is at position 1.

extractlengthbytes: This indicates the number of bytes to extract from the string, starting from the specified position.

Here's an example to demonstrate the usage of MIDB:

=MIDB("Hello, 世界!", 8, 6)

In this example, the string "Hello, 世界!" contains a mix of English and Chinese characters.

The function MIDB extracts 6 bytes starting from the 8th character position, resulting in the output "世界!" which means "world" in Chinese.

Please note that the MIDB function works with byte positions, not character positions, so it's important to be aware of the specific encoding of the text string you're working with to ensure accurate extraction.

Want even more from Google Sheets?


With Softr, you can turn your spreadsheets into powerful web apps.You can give advanced roles and permissions to each user, build advanced logic and automation flows, customize the design to your needs, and much more.


Softr also offers a growing library of templates for internal tools, client portals, community hubs, and more. The templates come with a Google Sheet or an Airtable base that you can use to store and manage your data easily.


Try Softr now and build your custom web apps in 10 minutes no code required!