How to Remove Numbers From Cells Which Containing Texts and Numbers in Excel?


With the help of Microsoft Excel, users may successfully manage and evaluate data. Nevertheless, working with cells that combine text and numbers can occasionally be difficult, particularly when you need to extract only the textual data from such cells. This course will provide you with the skills to accomplish any task with ease, whether it be tidying up jumbled data, separating alphanumeric sequences, or just extracting the textual content for additional research.

Remove Numbers From Cells Which Containing Texts and Numbers

Here we will first create a user-defined function using VBA and then use the formula to complete the task. So let us see a simple process to know how you can remove numbers from cells that contain text and numbers in Excel.

Step 1

Consider an Excel sheet where you have a list of strings that contain both text and numbers, similar to the below image.

First, right-click on the sheet name and select View code to open the VBA application.

Right-click > View Code.

Step 2

Then click on Insert and select Module, then copy the below code into the text box.

Insert > Module > Copy.

Code

Function OnlyRemoveNumbers(strTxt As String) As String
   Application.ScreenUpdating = False
   With CreateObject("VBScript.RegExp")
      .Global = True
      .Pattern = "[0-9]"
      OnlyRemoveNumbers = .Replace(strTxt, "")
   End With
   Application.ScreenUpdating = True
End Function

Step 3

Then close VBA using Alt + Q. Then click on an empty cell and enter the formula as =OnlyRemoveNumbers(A2), click enter, and drag down using the autofill handle.

This is how you can remove numbers from cells that contain texts and numbers in Excel.

Conclusion

In this tutorial, we have used a simple example to demonstrate how you can remove numbers from cells containing texts and numbers in Excel to highlight a particular set of data.

Updated on: 08-Sep-2023

270 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements