Sometimes we insert both the texts and numbers into the same Excel cell. For some reason, we may want to remove the texts from the cell keeping only the numbers. For this purpose, Excel offers multiple ways to remove texts while keeping the numbers. In this article, you will learn 8 ways to remove text from an Excel cell but leave the numbers there.
Download Practice Workbook
You can download the Excel file from the following link and practice along with it.
8 Ways to Remove Text from an Excel Cell but Leave Numbers
1. Use Find and Replace to Remove Text from an Excel Cell but Leave Numbers
The easiest way to remove text from a cell leaving the numbers is to use the Find and Replace command.
Now follow the steps below to use the Find and Replace feature.
❶ First select the cells having texts and numbers merged.
❷ Then hit CTRL + H to avail the Find and Replace dialog box.
❸ Type the text that you want to remove within the Find what box.
❹ Leave the Replace with box blank.
❺ Now hit the Replace All button.
❻ Finally hit the Close button to exit the Find and Replace dialog box.
Thus you have deleted all the text from the Excel cells leaving the numbers only in their places.
Read More: How to Remove Specific Text from Cell in Excel (Easiest 11 Ways)
2. Delete Text from an Excel Cell but Leave Numbers with SUBSTITUTE Function
You can use the SUBSTITUTE function instead of using the Find and Replace dialog box. Both do the same task.
For that,
❶ Click on cell C5.
❷ Now insert the following formula:
=SUBSTITUTE(B5,"KKV","")
Here,
- B5 refers to the cells having texts and numbers.
- “KKV” is the text to replace with blanks (“”).
❸ After that hit the ENTER button.
❹ Now drag the Fill Handle icon from cell C5 to C12.
So you will see the SUBSTITUTE function has replaced all the texts with blanks. Thus, only the numbers are remaining.
Read More: How to Remove Specific Text from a Column in Excel (8 Ways)
3. Combination of TEXTJOIN, ROW, INDIRECT, LEN, & IFERROR Functions to Remove Text but Leave Numbers
You can also use the TEXTJOIN, ROW, INDIRECT, LEN, & IFERROR Functions to make a formula. This formula will delete all the texts from an Excel cell but leave the numbers.
For this,
❶ Select cell C5 first.
❷ Then insert the following formula:
=TEXTJOIN("", TRUE,IFERROR(MID(B5, SEQUENCE(LEN(B5)), 1) *1, ""))
In this formula:
- B5 refers to cell having texts and numbers.
- LEN(B5) returns the length of the contents of cell B5.
- SEQUENCE(LEN(B5)) returns the sequence of cell B5 which is {1;2;3;4;5;6;7}.
- MID(B5,SEQUENCE(LEN(B5)), 1) returns the position of the blank encountered from left. The output is {“K”;”K”;”V”;” “;”5″;”0″;”6”}.
- IFERROR(MID(B6,SEQUENCE(LEN(B6)), 1) *1, “”) handles any errors within MID(B5,SEQUENCE(LEN(B5)), 1).
- TEXTJOIN(“”, TRUE,IFERROR(MID(B5,SEQUENCE(LEN(B5)), 1) *1, “”)) removes text by replacing the texts with blanks. Then it joins those blanks with the numbers.
❸ Now hit the ENTER button.
❹ Drag the Fill Handle icon from cell C5 to C12.
Finally, you will have just numbers in the cells without any texts.
4. Remove Text from an Excel Cell but Leave Numbers Using RIGHT and LEN Functions
Follow the steps below to combine the RIGHT and LEN functions to remove text from an Excel cell leaving the numbers.
❶ First of all, select cell C5.
❷ Then insert the following formula in cell C5.
=RIGHT(B5, LEN(B5)-3)
In this formula,
- LEN(B5) calculates the length of contents in cell B5.
- LEN(B5)-3) removes 3 characters from the total length of the contents of cell B5.
- RIGHT(B5, LEN(B5)-3) removes 3 characters from the right side of the B5 cell contents. Thus we have just the numbers without any texts.
❸ After that hit the ENTER button.
❹ Drag the Fill Handle icon from cell C5 to C12.
Finally, you will have all the cells with numbers only as in the screenshot below:
Read More: How to Remove Text After Character in Excel (3 Ways)
5. Use an Array Formula to Remove Text from an Excel Cell but Leave Numbers
You can use the following array formula to remove text from an Excel cell leaving all the numbers. To use the array formula:
❶ First select cell, C5.
❷ Then insert the following array formula there:
=SUM(MID(0&B5,LARGE(INDEX(ISNUMBER(--MID(B5, ROW($1:$99),1))*ROW($1:$99),),ROW($1:$99))+1, 1)*10^ROW($1:$99)/10)
❸ After that hit the ENTER button to execute the array formula.
❹ Place your mouse cursor at the right bottom corner of cell C5 and drag down the Fill Handle icon.
Now you will see that the array formula has deleted the texts from the Excel cells leaving only the numbers.
Read More: How to Remove Text between Two Characters in Excel (3 Easy Ways)
6. Remove Text from an Excel Cell but Leave Numbers Using Text to Columns Feature
The Text to Columns command splits off the text from the numbers.
Now follow the steps below to learn the process to do so.
❶ Select all the cells containing texts with numbers.
❷ Then go to Data > Data Tools > Text to Columns.
❸ Select Fixed Width from the Convert Text to Columns Wizard dialog box and hit the Next button.
❹ Again hit the Next button in the Convert Text to Columns Wizard dialog box.
❺ Then make sure the General option is selected and hit Finish.
Now you have successfully removed text from all the Excel cells leaving the numbers.
7. Use Flash Fill to Remove Text from an Excel Cell but Leave Numbers
To remove texts from an Excel cell using the Flash Fill feature,
❶ Insert only the numbers in an adjacent cell.
❷ Then go to Home > Editing > Fill > Flash Fill.
After hitting the Flash Fill command, you will get only the numbers in the cell without the texts.
Read More: How to Remove Text From Excel Cell (9 Easy Ways)
8. Delete Text from an Excel Cell but Leave Numbers with VBA Scripts
We will create a user-defined function called DeleteTextsButNumbers with a VBA script to remove text from an Excel cell leaving the numbers.
For that,
❶ Press ALT + F11 to open the VBA editor.
❷ Go to Insert > Module.
❸ Then copy the following VBA code:
Function DeleteTextsButNumbers(xTxt1 As String) As String
With CreateObject("VBScript.RegExp")
.Global = True
.Pattern = "\D"
DeleteTextsButNumbers = .Replace(xTxt1, "")
End With
End Function
❹ Paste and save the code in the VBA editor.
Here, I’ve created a function named DeleteTextButNumbers by using the VBA Replace function where it will take the cell value as a String to replace the texts with blanks as a result will leave the numbers.
❺ Now come back to the datasheet and select cell C5.
❻ Insert the following formula there.
=DeleteTextsButNumbers(B5)
❼ Then hit ENTER.
❽ Drag the Fill Handle icon from cell C5 to C12.
After that you will see that the function has deleted all the texts leaving the numbers as in the picture below:
Read More: How to Delete Defined Names in Excel (3 Ways)
Practice Section
You will find an Excel sheet like the following image to practice at the end of the provided Excel file.
Conclusion
To sum up, we have discussed 8 methods to remove text from an Excel cell but leave the numbers. You are recommended to download the practice workbook attached along with this article and practice all the methods with that. And don’t hesitate to ask any questions in the comment section below. We will try to respond to all the relevant queries asap. And please visit our website Exceldemy to explore more.