9.8 Creating and Using Basic Formulas: Using Text Functions in Google Sheets

Electronic spreadsheets, such as Google Sheets, are powerful tools for data management and information analysis. One of the most valuable features of Google Sheets is the ability to manipulate and work with text through specific formulas and functions. In this chapter, we'll explore some of the most useful text functions: CONCATENATE, LEFT, RIGHT, and SEARCH.

CONCATENATE function

The CONCATENATE function is used to combine two or more text strings into a single string. This is especially useful when you need to join information from different cells, such as first and last names, or addresses that are divided into multiple columns.

Syntax:
CONCATENATE(text1, [text2, ...])

Example:

  • Suppose you have the first name in one cell (A1) and the last name in another cell (B1). To combine these two into a complete cell, you would use: =CONCATENATE(A1, " ", B1). The space between the quotation marks is used to separate the first name from the last name.

LEFT function

The LEFT function is used to extract a specific number of characters from a text string, starting from the first (left) character. This can be useful for extracting codes or identifiers that follow a fixed character pattern.

Syntax:
LEFT(text, [number_of_characters])

Example:

  • If you have a product code like "AB12345" in a cell (A1) and want to extract just the letters "AB", you would use: =LEFT(A1, 2).
  • li>

RIGHT function

Similar to the LEFT function, the RIGHT function is used to extract characters from a text string, but starting from the last character (on the right). This function is useful when the characters you want are at the end of the string.

Syntax:
RIGHT(text, [number_of_characters])

Example:

  • Using the same product code "AB12345" in cell A1, to extract just the numbers "12345", you would use: =RIGHT(A1, 5).

SEARCH function

The SEARCH function is used to find the position of a text string within another string. It's very useful for finding specific substrings, like an email domain within a full address or an area code within a phone number.

Syntax:
SEARCH(searched_text, search_text_in, [start_position])

Example:

  • To find the position of the "@" in an email address like "user@example.com" in cell A1, you would use: =SEARCH("@", A1). This would return the number 8, indicating that the "@" is in the eighth position of the string.

It is important to note that the SEARCH function is case sensitive and does not allow the use of wildcards. For a case-insensitive search or that allows wildcards, you can use the VLOOKUP function.

Practical Examples

Let's consider some practical examples of how these functions can be combined to perform more complex tasks.

Let's imagine that you are working with an email list and you want to extract only the user names, which are before the "@".

Formula:
=LEFT(A1, SEARCH("@", A1) - 1)

This formula combines the LEFT and SEARCH functions to extract everything before the "@". The SEARCH function finds the position of the "@", and the LEFT function uses that number minus one to return just the user's name part.

Another example would be combining information from multiple cells into a specific format. Suppose you have the date, month, and year in separate cells and want to combine them into a formatted date.

Formula:
=CONCATENATE(RIGHT("0" & ​​DAY(A1), 2), "/", RIGHT("0" & ​​MONTH(A1), 2), "/", YEAR(A1))

In this example, the RIGHT and CONCATENATE functions are used to ensure that the day and month are always two digits, adding a "0" to the left when necessary, and then combining them with the year to form a complete date.

Conclusion

Mastering the text functions in Google Sheets can significantly increase efficiency and accuracy when working with textual data. CONCATENATE, LEFT, RIGHT, and SEARCH are just a few of the many functions available that, when understood and applied correctly, can solve a wide range of analytical needs. With practice and experimentation, you may discover new ways to manipulate and analyze text data to meet your specific needs.

Now answer the exercise about the content:

Which of the following statements about text functions in Google Sheets is correct?

You are right! Congratulations, now go to the next page

You missed! Try again.

Article image Creation and use of basic formulas: Handling errors in formulas (IFERROR, ERRORS)

Next page of the Free Ebook:

18Creation and use of basic formulas: Handling errors in formulas (IFERROR, ERRORS)

5 minutes

Obtenez votre certificat pour ce cours gratuitement ! en téléchargeant lapplication Cursa et en lisant lebook qui sy trouve. Disponible sur Google Play ou App Store !

Get it on Google Play Get it on App Store

+ 6.5 million
students

Free and Valid
Certificate with QR Code

48 thousand free
exercises

4.8/5 rating in
app stores

Free courses in
video, audio and text