
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Remove Letters from Strings, Numbers, and Cells in Excel
This comprehensive book will cover a variety of techniques for effectively extracting numerical values from mixed data, including cells with a mix of letters and digits, alphanumeric combinations, and strings with embedded numbers. Excel offers a variety of methods to complete this operation quickly and effectively thanks to its robust functions and formulae.
Learning these strategies will unquestionably improve your data manipulation abilities and help you save time while working with datasets, whether you are a novice or a seasoned Excel user. In various situations, including data cleaning, text processing, and preparing data for additional analysis, removing letters from mixed data is a frequent requirement.
Remove Letters From Strings/Numbers/Cells
Here we will first create a user-defined formula using VBA and then use the formula to complete the task. So let us see a simple process to know how you can remove letters from strings, numbers, or cells in Excel.
Step 1
Consider an Excel sheet where the data is 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 StripChar(Txt As String) As String With CreateObject("VBScript.RegExp") .Global = True .Pattern = "\D" StripChar = .Replace(Txt, "") End With End Function
Step 3
Then close VBA using Alt + Q. Then click on an empty cell and enter the formula as =StripChar(A2) and click enter. Then drag down using the autofill handle.
Alt + Q > Empty Cell > Formula > Enter > Drag.
This is how you can remove letters from strings in Excel.
Conclusion
In this tutorial, we have used a simple example to demonstrate how you can remove letters from strings, numbers, or cells in Excel to highlight a particular set of data.