MID

Formulas / MID
To extract text from a given string.
MID(text,start_num,num_chars)
  • text - the string with the characters to extract
  • start_num - the position of the first character to extract
  • num_chars - the number of characters to extract

Examples

  • =MID("apple",2,3) // returns "ppl"
  • =MID("The cat in the hat",5,3) // returns "cat"

    In this example, MID returns "cat" because "cat" is the set of 3 characters starting from the 5th character in the string provided.

  • =MID("The cat in the hat",16,3) // returns "hat"

    MID returns "hat" in this example because "hat" is the set of 3 characters starting from the 16th character.

  • =MID("apple",3,100) // returns "ple"

    Here's an example where the number of characters to extract is greater than the length of the substring. For this example, "ple" is returned because 100 is greater than the length of "apple".

  • =MID(12348,3,4) / returns "348" as text

    In this example, "348" is returned instead of 348 because MID returns text.

Summary

MID is a Sourcetable function that returns characters from a text string, starting from a specified position.

  • MID takes three arguments, all of which are required.
  • Note that MID extracts all remaining text if num_chars is greater than the number of available characters.
  • MID can be used for extracting text from the middle of a string, which is useful if you know where you want to extract text from.
  • RIGHT and LEFT are similar to MID. The difference is that LEFT extracts text from the left side of a string, and RIGHT extracts text from the right side of a string.
  • If you don't know where to start extracting text from, you can combine MID with FIND or SEARCH to find the unknown starting position.


Frequently Asked Questions

What is the MID function?
The MID function is a built-in function in Sourcetable that allows you to extract a specific number of characters from a text string, starting at a specific position. MID is a useful function for extracting information from text strings that have a specific format.
How does the MID function work?
The number of characters MID extracts is specified by the start_num argument. The characters MID extracts are from text starting at start_num but do not include the position of the first character of text. The characters MID extracts must be between 1 and 256 characters long.MID returns the characters up to the end of the text if start_num plus num_chars exceeds the length of text and start_num is less than the length of text.
What types of errors does MID return?
MID returns a #VALUE! error if num_chars is negative or if start_num is less than 1.
What are some uses for the MID function?
MID is a useful function for extracting information from text strings that have a specific format. For example, you can use MID to extract the area code from a phone number, or the day from a date. MID is also useful for extracting a specific number of characters from a text string.
Sourcetable Logo

Work smarter

Al is here to help. Leverage the latest models to
analyze spreadsheets, enrich data, and create reports.

Drop CSV