How to Use the MID, MIDBs Function in Excel

Welcome to this article, where we’ll explore the use of the MID and MIDBs functions in Microsoft Excel and Google Sheets. These functions allow you to extract a specified number of characters from a text string, starting at a particular position.

Basic Syntax

The syntax for the MID function is as follows:

=MID(text, start_num, num_chars)
  • text: The text string from which characters are to be extracted.
  • start_num: The position where the extraction of characters starts.
  • num_chars: The number of characters to be extracted.

The MIDBs function, used in Google Sheets particularly for double-byte character languages like Japanese, Chinese, or Korean, functions similarly.

Example 1: Using MID

Consider that cell A1 contains the phrase “Hello, World!”. To extract the word “World”, use the following formula:

Formula Result
=MID(A1, 8, 5) World

Example 2: Using MIDBs

If you have a cell in Google Sheets (A1) with the Chinese characters “你好,世界!”, and you wish to extract the second character, you would use:

Formula Result
=MIDBs(A1, 2, 1)

Scenario: Extracting Domain Name

Imagine you need to extract domain names from a column of email addresses. This can be accomplished by combining the MID function with FIND and LEN. For an email address in cell A1, use:

=MID(A1, FIND("@", A1) + 1, LEN(A1) - FIND("@", A1))

This formula locates the “@” symbol, begins extracting characters right after it, and computes how many characters remain to be extracted up to the end of the string.

By using the MID and MIDBs functions, you can efficiently pull out specified portions of data from text strings in both Excel and Google Sheets. Make sure to adapt the cell references and ranges as per your data structure.

More information: https://support.microsoft.com/en-us/office/mid-midb-functions-d5f9e25c-d7d6-472e-b568-4ecb12433028

Other functions
Returns an array of text values from any specified range
Changes full-width (double-byte) English letters or katakana within a character string to half-width (single-byte) characters
Converts a number to text, using the ß (baht) currency format
Returns the character specified by the code number
Removes all nonprintable characters from text
Returns a numeric code for the first character in a text string
Combines the text from multiple ranges and/or strings, but it doesn't provide the delimiter or IgnoreEmpty arguments
Joins several text items into one text item
Changes half-width (single-byte) English letters or katakana within a character string to full-width (double-byte) characters
Converts a number to text, using the $ (dollar) currency format
Checks to see if two text values are identical
Finds one text value within another (case-sensitive)
Formats a number as text with a fixed number of decimals
Changes half-width (single-byte) characters within a string to full-width (double-byte) characters
Returns the leftmost characters from a text value
Returns the number of characters in a text string
Converts text to lowercase
Converts text to number in a locale-independent manner
Extracts the phonetic (furigana) characters from a text string
Capitalizes the first letter in each word of a text value
Replaces characters within text
Repeats text a given number of times
Returns the rightmost characters from a text value
Finds one text value within another (not case-sensitive)
Substitutes new text for old text in a text string
Converts its arguments to text
Formats a number and converts it to text
Combines the text from multiple ranges and/or strings, and includes a delimiter you specify between each text value that will be combined If the delimiter is an empty text string, this function will effectively concatenate the ranges
Removes spaces from text
Returns the Unicode character that is references by the given numeric value
Returns the number (code point) that corresponds to the first character of the text
Converts text to uppercase
Converts a text argument to a number
Returns text from any specified value