Working with Substrings

Substring

Small strings inside a STRING.

For example

A STRING: “India is a Great Country”

Substring can be

      1. India is
      2. India
      3. Great country
      4. Is a great
      5. So on….

You might want to extract the first few letters of a STRING. Excel gives you three functions for extracting substrings, as described in the next three sections.

LEFT()

The LEFT() function returns a specified number of characters starting from the left of a string:

LEFT( text [, num_chars ])

text                       The string from which you want to extract the substring

num_chars         The number of characters you want to extract from the left. The default value is 1.

For example, the following formula returns the substring India:

=LEFT(“India is a Great Country”, 5)

 

RIGHT()

The RIGHT() function returns a specified number of characters starting from the right of a string:

RIGHT( text [, num_chars ])

text                       The string from which you want to extract the substring

num_chars         The number of characters you want to extract from the right. The default value is 1.

For example, the following formula returns the substring Country:

=RIGHT(“India is a Great Country”, 7)

 

MID()

The MID() function returns a specified number of characters starting from any point within a string:

MID( text , start_num , num_chars )

text                       The string from which you want to extract the substring

start_num           The character position at which you want to start extracting the substring

num_chars         The number of characters you want to extract

For example, the following formula returns the substring Great:

=MID(“India is a Great Country”, 12, 5)

This was the short and brief demo showing the way to use substring extraction functions : Left(), Right(), and Mid(). These function may be useful in situations like : extracting the last name of a customer, extracting last 4 digits from Aadhar Number, etc. 

I hope you found the article helpful. Please share any further queries or recommendations and feedback with us in the comments section below.

1 thought on “Working with Substrings”

Leave a Comment

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