Excel Functions and Formulas Get Substring, MID(), LEFT(), RIGHT()

In this article I will explain the functions MID(), LEFT(), RIGHT(). The main purpose of these functions is to return a certain number of characters (substring) from a text. You can download the workbook related to this article here.

Jump To:

Contents

Syntax:

=LEFT(Text, Num_Chars)

Returns the specified number of characters from the start of the text string.

  • Text: The text string containing the characters you want to extract.
  • Num_Chars: The number of characters to return.

=RIGHT(Text, Num_Chars)

Returns the specified number of characters from the end of the text string.

  • Text: The text string containing the characters you want to extract.
  • Num_Chars: The number of characters to return.

=MID(Text, Start_Num, Num_Chars)

Returns the specified number of characters starting from the specified index of the text string.

  • Text: The text string containing the characters you want to extract.
  • Start_Num: The position of the first character you want to extract.
  • Num_Chars: The number of characters to return.

LEFT():

In the example below the user inputs the text in cell A2. Selects the number of characters to return in cell B2. Cell C3 displays the a substring from cell A2, starting from the beginning up to the number of characters chosen in cell B2:

Excel, LEFT, Formulas

Result:

Excel, LEFT, Formulas, Result


RIGHT():

In the example below the user inputs the text in cell A2. Selects the number of characters to return in cell B2. Cell C3 displays a substring from cell A2, starting from the end up to the number of characters chosen in cell B2:

Excel, RIGHT, Formulas

Result:

Excel, Right, Formulas, Result


MID():

In the example below the user inputs the text in cell A2. Selects the number of characters to return in cell B2 and the starting index to extract the characters from in cell C2 . Cell E2 displays a substring from cell A2, starting from the index specified in cell C2, with the amount of characters specified in cell B2:

Excel, MID, Formulas

Result:

Excel, MID, Formulas, Result

See also:

You can download the workbook related to this article here.

If you need assistance with your code, or you are looking to hire a VBA programmer feel free to contact me. Also please visit my website  www.software-solutions-online.com

Leave a Reply

Your email address will not be published. Required fields are marked *