How to Remove the First N Characters in Google Sheets

Published on

You may want to remove the first n characters in Google Sheets to clean text strings. Which is the suitable function to do this?

To remove the first n characters in a single cell or column, you can use the functions REPLACE, RIGHT+LEN, MID+LEN, REGEXREPLACE, or REGEXEXTRACT functions.

The simplest option is the REPLACE function. We will start with that and include other options as well for educational purposes.

Removing the First N Characters Using the REPLACE Function in Google Sheets

Assume cell A1 contains the value “Mr. John”. To extract the name only from this string and remove the title “Mr. ” (a total of 4 characters), use the following formula in cell B1:

=REPLACE(A1, 1, 4, "")

This formula follows the syntax REPLACE(text, position, length, new_text), where:

  • text: The cell reference (A1 in this case)
  • position: The starting position of the text to replace (1 here, meaning the first character)
  • length: The number of characters to replace (4 here, the length of “Mr. “)
  • new_text: The text to replace with (“” here, an empty string)

The REPLACE function replaces part of the text in cell A1, starting from the first character and spanning 4 characters, with an empty string, effectively removing “Mr. ” and leaving “John”.

Note: When you use the REPLACE function to replace the first n digits in a number, the output will be text formatted. In that case, use the VALUE function to convert it back to a number, as shown below:

=VALUE(REPLACE(A1, 1, 5, ""))

This formula will return 67890 if the number in cell A1 is 1234567890.

Removing the First N Characters from Texts in a Column

In the following example, names with their titles are in column A, range A2:A15. Each title is 4 characters long, such as “Mr. ” and “Ms. “.

You can use ARRAYFORMULA with REPLACE to apply the formula to all rows in the column without needing to copy and paste it individually.

Here’s how to do it:

=ArrayFormula(REPLACE(A2:A15, 1, 4, ""))

Apply this formula in cell B2 to remove the titles “Mr. ” or “Ms. ” from the names in column A.

Removing the First N Characters from Text in a Column

What About Texts in Multiple Columns?

Yes! The REPLACE and ARRAYFORMULA combo will work with data in multiple columns.

Example:

=ArrayFormula(REPLACE(A2:B10, 1, 3, ""))

Alternative Solutions

As mentioned earlier, other functions can be used to remove the first n characters from a text. I am listing them below so you are aware of them when you encounter them in a shared sheet. Replace n with the number of characters you want to remove.

=RIGHT(A1, LEN(A1)-n)

Extracts all characters from the right of cell A1, excluding the first n characters.

=MID(A1, n+1, LEN(A1))

Extracts all characters from cell A1 starting at position n + 1 to the end of the string.

=REGEXREPLACE(A1, "^.{n}", "")

Removes the first n characters from the text in cell A1.

=REGEXEXTRACT(A1, REPT(".", n) & "(.*)")

Extracts all characters from cell A1, excluding the first n characters.

All these formulas will work with the ARRAYFORMULA function, similar to the REPLACE function. Please note that REGEXREPLACE and REGEXEXTRACT are specifically for text, not numbers.

Resources

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

How to Extract Numbers from Text in Excel with Regex

You can use the REGEXEXTRACT or REGEXREPLACE functions to easily extract numbers from text...

Using OFFSET and MATCH Together in Google Sheets: Advanced Tips

One powerful and flexible way to look up values is by combining the OFFSET...

How to Use OFFSET and XMATCH Functions Together in Excel

We often use the OFFSET and XMATCH functions together to match a value in...

How to Calculate Maximum Drawdown in Excel and Google Sheets

You can use the following dynamic array formula to calculate maximum drawdown (MDD) in...

More like this

Using OFFSET and MATCH Together in Google Sheets: Advanced Tips

One powerful and flexible way to look up values is by combining the OFFSET...

Running Count with Structured References in Google Sheets

Running a count with structured references is achievable in Google Sheets tables using the...

Running Total with Structured Table References in Google Sheets

You can use two types of formulas to create a running total with structured...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.