“How can I extract the first two words from a cell in Google Sheets?”

How to Extract the First Two Words from a Google Sheets Cell

The Challenge of Google Sheets String Manipulation

Data cleansing and analysis often require precise string manipulation, especially when dealing with unstructured or poorly formatted text entries. In powerful spreadsheet applications like Google Sheets, users frequently encounter scenarios where they only need to isolate specific components of a text string—such as the first name and middle name from a full name list, or the category identifiers from a descriptive phrase. Extracting the first two words from a cell is a common requirement in these data processing workflows. While this task seems straightforward, it demands a sophisticated combination of built-in functions because Google Sheets lacks a simple dedicated function like “EXTRACT_FIRST_N_WORDS.”

The complexity arises because words are typically delineated by spaces, and we must programmatically determine the exact position of the second space to isolate the desired substring. A naive approach might involve chaining multiple LEFT function and FIND function calls, first finding the end of the first word, and then calculating the offset to find the end of the second word. However, this method quickly becomes cumbersome and difficult to maintain. Fortunately, there is a far more elegant and efficient solution that relies on creatively utilizing the SUBSTITUTE function to locate the precise cutoff point, allowing for reliable extraction regardless of the phrase length.

The methodology we will detail here provides a robust framework for handling textual data where the number of words is variable. This technique is particularly valuable for cleaning datasets derived from external sources, such as web scraping results or survey responses, where uniformity cannot be guaranteed. Mastering this specific combination of functions—LEFT, FIND, and SUBSTITUTE—is essential for any advanced Google Sheets user aiming for high levels of data automation and accuracy.


You can use the following syntax to extract the first two words from a cell in Google Sheets:

=LEFT(A2,FIND("*",SUBSTITUTE(A2," ","*",2))-1)

This particular formula will extract the first two words from the string located in cell A2, providing a concise and effective solution for this complex extraction task.

The Advanced Formula Explained: Combining LEFT, SUBSTITUTE, and FIND

The core of this powerful formula lies in its nested structure, which cleverly isolates the exact position needed for the extraction. We utilize three distinct functions: LEFT, SUBSTITUTE, and FIND. Instead of attempting to locate the second space directly, which would require complex indexing, we temporarily modify the original string to make the target location easy to identify. This is the central innovation of this approach, ensuring high reliability across various data types.

The process begins with the innermost function, SUBSTITUTE, which is responsible for finding the second space and replacing it with a unique, easily searchable character, such as an asterisk (*). Once this replacement occurs, the string contains a distinct marker exactly where the second word ends. We then use the FIND function to locate this new marker. Finally, the outermost LEFT function uses the position determined by FIND to extract the necessary characters from the beginning of the original string.

This nested method is highly efficient because it avoids iterative calculations and array formulas, making it fast and scalable even when applied to thousands of rows of data. Understanding the role of each function within the formula is key to adapting it for similar text manipulation tasks, such as extracting the first three words, or perhaps the last word, by adjusting the parameters of the internal functions. We will now dissect each functional component to provide a deeper understanding of the mechanism at work.

Step-by-Step Breakdown of the SUBSTITUTE Component

The first critical step involves the SUBSTITUTE function. Unlike the `REPLACE` function, which operates based on a specific position, SUBSTITUTE allows us to replace specific text within a string. Crucially, it supports an optional argument specifying which occurrence of the text should be replaced. The syntax used in our formula is SUBSTITUTE(A2, " ", "*", 2).

Let’s break down the arguments:

  1. A2: This is the text string where the substitutions will occur.
  2. ” “: This is the search_for argument, indicating we are looking for a standard space character.
  3. “*”: This is the replace_with argument. We are temporarily replacing the found space with an asterisk (*), a character unlikely to appear naturally in the text and therefore an excellent unique marker.
  4. 2: This is the occurrence argument. This is the most crucial part. By setting this value to 2, we instruct SUBSTITUTE to only replace the second instance of the space character, leaving all other spaces and characters untouched.

The result of this internal operation is a modified string where the character immediately following the second word is now an asterisk. For example, if cell A2 contains “The quick brown fox jumps,” the result of the SUBSTITUTE operation would be “The quick*brown fox jumps.” This temporary modification effectively isolates the boundary we need for extraction, simplifying the subsequent steps considerably. It is important to note that if the string contains fewer than two words (i.e., fewer than two spaces), the SUBSTITUTE function will simply return the original string unchanged, which ensures the rest of the formula handles edge cases gracefully, although it may still result in an error in the final step if the * cannot be found.

Leveraging the FIND Function for Positional Indexing

Following the internal substitution, the next layer of the formula uses the FIND function. The primary purpose of FIND is to locate the starting position of one text string within another. In our context, we are searching for the position of the special marker we just inserted. The structure used is FIND("*", SUBSTITUTE_RESULT).

The FIND function is ideal here because it is case-sensitive (though not strictly necessary since we used a special character, *), and it returns the numerical index of the first character found. By searching for the asterisk (*), the FIND function returns the character position corresponding to the start of the asterisk itself. Returning to our example, if “The quick brown fox jumps” became “The quick*brown fox jumps,” and assuming “T” is position 1, the asterisk might be at position 10. The value 10 signifies the exact point immediately following the character sequence we wish to extract (i.e., “The quick”).

Crucially, the numerical position returned by FIND represents the character count required for the extraction. However, since the asterisk itself replaced a space—and we only want the words, not the space or the asterisk—we must adjust this count. The position returned by FIND is one character too large. This leads directly to the final necessary mathematical adjustment: subtracting one. The resulting value, FIND("*", SUBSTITUTE_RESULT) - 1, provides the precise length needed for the LEFT function to accurately capture the first two words.

Finalizing the Extraction with the LEFT Function

The outermost function in the formula is the LEFT function. The LEFT function extracts a specified number of characters from the beginning (the left side) of a text string. Its syntax is straightforward: LEFT(string, number_of_characters). In our complete formula, the original cell reference (A2) serves as the string, and the entire nested FIND/SUBSTITUTE structure calculates the required number_of_characters.

The full formula structure, LEFT(A2, FIND(..., 2) - 1), ties all the previous steps together. It takes the original content of A2 and truncates it exactly at the position calculated by the internal logic. This final length calculation is critical for success: the LEFT function retrieves characters starting from the left, up to the point just before the second space (which was temporarily marked by the asterisk). The subtraction of 1 ensures that the output string ends precisely after the second word, omitting the placeholder character (*).

For instance, if the calculated length returned by FIND(...) - 1 is 9, the LEFT function will take the first 9 characters of cell A2. If A2 contains “Analytical Data Set,” the first nine characters would be “Analytical.” Wait, this example is poor. Let’s use “The quick brown fox.” The second space is at position 8 (T-1, h-2, e-3, space-4, q-5, u-6, i-7, c-8, k-9). No, the sequence is: T-1, h-2, e-3, (space)-4, q-5, u-6, i-7, c-8, k-9, (space)-10, b-11. The second space is at position 10. The SUBSTITUTE replaces position 10 with *. FIND finds * at 10. 10 – 1 = 9. LEFT takes 9 characters: “The quick”. This confirms the logic.

Practical Application: Extracting Data from a List

Understanding the theoretical breakdown is essential, but seeing the formula in action provides the clearest illustration of its utility. This methodology is particularly useful when you need to standardize a column of text entries in Google Sheets, perhaps by normalizing product descriptions or extracting organizational prefixes.

The following example shows how to use this syntax in practice.

Example: Extract First Two Words from Cell in Google Sheets

Suppose we have the following list of phrases in Google Sheets:

Suppose that we would like to extract the first two words from each cell in Column A and place the results in Column B. This process allows us to quickly isolate core descriptors from the longer, more detailed strings.

We can type the following formula into cell B2 to do so, targeting the string found in A2:

=LEFT(A2,FIND("*",SUBSTITUTE(A2," ","*",2))-1)

We can then click and drag this formula down to each remaining cell in column B using the fill handle:

Google Sheets extract first two words

As demonstrated above, Column B now contains the first two words from each corresponding string in column A. This method works universally, regardless of how long the string or phrase is in any given cell, providing a resilient solution for diverse data inputs.

Handling Edge Cases and Errors

While this formula is highly reliable, it is important to consider edge cases where the data might not conform to expectations, specifically when dealing with cells containing fewer than two words. If cell A2 contains only “Data,” the SUBSTITUTE function will not find a second space, thus returning the original string. Consequently, the FIND function will fail to locate the asterisk (*), resulting in a #VALUE! error because the FIND function cannot return a position for a non-existent character.

To mitigate this potential error and ensure a clean dataset, users should wrap the primary formula within an IFERROR function. This practice allows the spreadsheet to return the entire content of the cell (or a custom message) if the extraction fails due to insufficient word count. A robust version of the formula for cell B2 might look like this: =IFERROR(LEFT(A2, FIND("*", SUBSTITUTE(A2, " ", "*", 2)) - 1), A2). This ensures that if the extraction fails (meaning there aren’t two words), the entire content of A2 is returned instead of an error message.

Another consideration involves leading or trailing spaces. While Google Sheets generally handles single internal spaces well, extraneous spaces at the beginning or end of a string can throw off the word count and positional calculations. It is always best practice to wrap the initial cell reference (A2) in the TRIM function to remove these unwanted spaces before performing the extraction. For maximum robustness, the formula becomes: =IFERROR(LEFT(TRIM(A2), FIND("*", SUBSTITUTE(TRIM(A2), " ", "*", 2)) - 1), A2).

Alternative Methodologies: Using REGEXEXTRACT

For users who are familiar with regular expressions, Google Sheets offers a powerful alternative: the REGEXEXTRACT function. This function allows for pattern-based extraction, which can sometimes be more concise for tasks involving complex string patterns. To extract the first two words using REGEXEXTRACT, we look for a pattern that matches any set of non-space characters, followed by a space, followed by another set of non-space characters, and then captures those two sets.

The appropriate regular expression pattern for this specific task is ^(S+s+S+). Let’s briefly examine this pattern:

  • ^: Anchors the match to the beginning of the string.
  • S+: Matches one or more non-space characters (the first word).
  • s+: Matches one or more space characters (the separator).
  • S+: Matches one or more non-space characters (the second word).
  • (): The parentheses create a capture group, ensuring that only the matched words are returned.

Therefore, the REGEXEXTRACT formula equivalent to our primary method is: =REGEXEXTRACT(A2, "^(S+s+S+)"). This is generally shorter and often preferred by developers comfortable with regular expressions, offering a powerful alternative to the nesting of LEFT, FIND, and SUBSTITUTE functions detailed previously.

Conclusion: Mastering Data Precision in Google Sheets

Extracting specific components from text strings is a fundamental skill in data management, and the method utilizing nested LEFT function, FIND function, and SUBSTITUTE function provides an extremely reliable way to isolate the first two words in Google Sheets. By strategically replacing the delimiter (the space) at the specific second occurrence, we create a precise positional marker that the FIND function can easily locate.

The elegance of this solution lies in its ability to adapt to varying string lengths without complicated array formulas or iterative logic. The internal mechanism calculates the exact required length dynamically, allowing the outer LEFT function to perform the final extraction efficiently. This composite function is a testament to the power of combining standard spreadsheet functions for complex SUBSTITUTE operations.

We encourage users to implement the robust version of the formula, incorporating IFERROR and TRIM, to ensure maximum compatibility and error handling across diverse datasets. Whether you choose the nested function approach or the concise REGEXEXTRACT method, mastering these techniques will significantly enhance your capability to clean, standardize, and analyze textual data within Google Sheets, moving beyond basic data entry to sophisticated data engineering.


Cite this article

mohammed looti (2026). How to Extract the First Two Words from a Google Sheets Cell. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-can-i-extract-the-first-two-words-from-a-cell-in-google-sheets/

mohammed looti. "How to Extract the First Two Words from a Google Sheets Cell." PSYCHOLOGICAL SCALES, 9 Jan. 2026, https://scales.arabpsychology.com/stats/how-can-i-extract-the-first-two-words-from-a-cell-in-google-sheets/.

mohammed looti. "How to Extract the First Two Words from a Google Sheets Cell." PSYCHOLOGICAL SCALES, 2026. https://scales.arabpsychology.com/stats/how-can-i-extract-the-first-two-words-from-a-cell-in-google-sheets/.

mohammed looti (2026) 'How to Extract the First Two Words from a Google Sheets Cell', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-can-i-extract-the-first-two-words-from-a-cell-in-google-sheets/.

[1] mohammed looti, "How to Extract the First Two Words from a Google Sheets Cell," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, January, 2026.

mohammed looti. How to Extract the First Two Words from a Google Sheets Cell. PSYCHOLOGICAL SCALES. 2026;vol(issue):pages.

Download Post (.PDF)
Slide Up
x
PDF
Scroll to Top