10 March 2022

How to remove numbers from text using Regex in Sheet

 



In this article, I will demonstrate how we can remove numbers using Regex in Google Sheets. Now, we, data lovers love to work with unstructured data. We could use machine learning tools such as Python and R. But, we could do little basics on spreadsheets. Google Sheets provide a wonderful function called "REGEX" which has basically three sub-functions: REGEXMATCH, REGEXTRACT, and "REGREPLACE." These three have different operations. Here, I shall be using the simple Find and Replace function.

1. Viewing text

I have added four titles. If we take a closer look into the Title column, we can see there are numbers in a form of year or others.


In four instances, numbers are in different positions.

2. Selecting the text's column

Next, we select the text and Edit it from the tab. After that, we need to click on the Find and Replace option from the list (shortcut: Ctrl+H).

3. Removing numbers

Lastly, we have to check the Search using regular expressions (1), then, in the Find box, we have to put \d (2) which will find all the digits. We will keep Replace with box blank. Finally, we will click the Replace all (3).


4. Result

All the numbers are removed by the simple trick.


This is how we can remove numbers from text. It is more or likes text preprocessing. 

Note: This article is only for educational purposes.