Home / Formula Types / Text / Mid

Formula generator for MID FUNCTION function

The MID function is used to extract a segment of a string based on the starting position and the length of the segment. It returns the specified segment of the string.

Formula generator

Spreadsheet AI is the #1 AI for generating and comprehending Excel and Google Sheets formulas. With its advanced capabilities, it goes beyond the basics by providing support for VBA and custom tasks. Streamline your spreadsheet with Spreadshee AI

Product Demo

How to generate an MID FUNCTION formula using AI.

To obtain information on the ARRAY_CONSTRAIN formula, you could ask the AI chatbot the following question: “To get the MID formula for extracting a specific number of characters from a text string, you can ask the AI chatbot the following question: "What formula can I use in Excel to extract a specific number of characters from a text string?"

MID FUNCTION formula syntax

The MID function in Excel allows you to extract a specific number of characters from a text string, starting at a specified position. The syntax for the MID function is as follows: MID(text, start_num, num_chars) - "text" is the text string from which you want to extract characters. - "start_num" is the position in the text string where you want to start extracting characters. The first character is considered to be at position 1. - "num_chars" is the number of characters you want to extract from the text string. Here's an example to illustrate the syntax: =MID("Hello World", 7, 5) In this example, the MID function will extract 5 characters from the text string "Hello World", starting at the 7th position. The result will be "World".

Use Cases & Examples

In these use cases, we use the MID function to extract a specific portion of text from a cell or string. The MID function allows us to specify the starting position and the number of characters we want to extract.

Extracting First Name


Extracts the first name from a full name string.


MID(A2, 1, FIND(" ", A2)-1)

Extracting Domain Name


Extracts the domain name from an email address.


MID(A2, FIND("@", A2)+1, LEN(A2)-FIND("@", A2)-FIND(".", REVERSE(A2, FIND("@", A2))))

Extracting Substring


Extracts a substring from a text based on a specific condition.


MID(A2, FIND("@", A2)+1, IF(ISNUMBER(FIND(".", A2, FIND("@", A2)+1)), FIND(".", A2, FIND("@", A2)+1), LEN(A2))-FIND("@", A2)-1)

AI tips

Enhance Your Excel Efficiency with AI Tips: Discover our innovative Excel add-in feature, ‘AI Tips.’ Streamline your workflow and boost productivity as AI-powered suggestions offer real-time insights for optimal spreadsheet organization, data analysis, and visualization. Elevate your Excel experience with intelligent recommendations tailored to your unique needs, helping you work smarter and achieve more.

Provide Clear Context

When describing your requirements to the AI, provide clear and concise context about the data you have, the specific task you want to accomplish, and any relevant constraints or conditions. This helps the AI understand the problem accurately.

Include Key Details

Include important details such as column names, data ranges, and specific criteria that need to be considered in the formula. The more precise and specific you are, the better the AI can generate an appropriate formula.

Use Examples

If possible, provide examples or sample data to illustrate the desired outcome. This can help the AI better understand the pattern or logic you are looking for in the formula.

Mention Desired Functionality

Clearly articulate the functionality you want the formula to achieve. Specify if you are looking for lookups, calculations, aggregations, or any other specific operations.


Frequently Asked Questions

  • The MID function is used to extract a substring from a given text string, starting at a specified position and with a specified number of characters.
  • The syntax of the MID function is: MID(text, start_num, num_chars), where 'text' is the text string from which you want to extract the substring, 'start_num' is the starting position of the substring, and 'num_chars' is the number of characters to be extracted.
  • Yes, the MID function can be used to extract a substring from a cell in Excel. Simply replace 'text' in the syntax with the cell reference.
  • If the 'start_num' parameter is greater than the length of the text string, the MID function will return an empty string.
  • No, the MID function can only be used to extract a substring from a single text string. To extract substrings from a range of cells, you can use other functions like CONCATENATE or TEXTJOIN along with the MID function.