How To Use LEFT / RIGHT in Google Sheets

Learn how to use the LEFT and RIGHT formulas in Google Sheets in this simple step by step tutorial.

LEFT / RIGHT Formulas in Google Sheets

The LEFT and the RIGHT formulas in Google Sheets help you to extract a substring from the beginning (LEFT) or from the end (RIGHT) of a specified string.

First we’ll check out the LEFT and then the RIGHT.

Let’s go.

What Is The LEFT Formula?

You can use the LEFT function to return a specific number of characters from the left side of a string. Its syntax is:

=LEFT(string, [number_of_characters])

In this function, you have to define the string variable. It is the input text from which the function returns the left part.

The number_of_characters variable specifies the length of the substring to return from the left side of the text. Its default value is 1. So it’s an optional variable and in case you don’t specify the number, the function returns the single leftmost character in the string.

For example, let’s return the country codes from the following IDs. To do this, we need the first two characters from the left part of the cell contents.

The following LEFT function extracts the two beginning characters:

=LEFT(A2,2)

You just need an input string (or a cell reference to it) and the length of the substring to extract it.

The function above works in the second row, and then the same function with the corresponding cell references was applied to the other rows as well.

When to use LEFT for marketing stuff?

  • Pulling text from either side of a specific character.
  • Extracting elements of a URL.

What Is The RIGHT Formula?

The syntax of the RIGHT function is very similar:

=RIGHT(string, [number_of_characters])

It has the same variables as the LEFT function. You need to use it the same way and the only difference is that returns the defined number of characters from the right side (the end) of a string.

If you want to output the last 5 characters of a string, you can use the following function:

=RIGHT(A2, 5)

The first argument is the cell reference to your string and the second argument is the number of characters you want to extract.

 

When to use RIGHT for marketing stuff?

  • Pulling text from either side of a specific character.
  • Extracting elements of a URL.

More LEFT / RIGHT Formula Examples

For a static number of characters, these formulas are pretty easy.

In day to day marketing works, things won’t always be easy. So let’s see an example where you can’t tell exactly how many characters you need…

For example, say you have some URLs starting with ‘https://’ and you want to extract their domain part without the ‘https://’. These useful parts of the URLs can have very different lengths.

In this case, you can combine the RIGHT function with the LEN function to calculate this number dynamically.

The RIGHT function needs two arguments, the string you want to cut and the number of characters you want to keep on the right side of the text.

The formula to do this is:

=RIGHT(A2, LEN(A2)-8)

Here we used the LEN function to help define the number_of_characters variable. We calculated the total number of characters in cell A2 with the LEN function. After that, we subtracted 8 which is the exact length of the unnecessary ‘https://’ part.

For example, the original cell A2 has 19 characters and we subtract 8. The second variable of the RIGHT function becomes 19-8=11. The RIGHT function extracts the 11 characters from the end of the string which is the useful part of the URL.

Thus, the formula changes the second variable dynamically according to the length of the URLs and outputs the right part of them without the first 8 characters.

Summary

That’s it!

Now you can now use the LEFT and RIGHT functions together with the other Google Sheets formulas to make your daily marketing tasks a bit easier.