Skip to main content

How to remove texts before or after a specific character from cells in Excel?

This article introduces different methods of removing texts before or after a specific character or the nth occurrence character from cells in Excel.


Delete texts before or after specific character by Find and Replace in Excel

For removing all texts before or after a specific character with the Find and Replace function, please do as follows.

1. Select the cells you will remove texts before or after a specific character, press Ctrl + H keys to open the Find and Replace dialog.

In the Find and Replace dialog box:

1. For removing all before the specific character such as comma, please type *, into the Find what text box;

2. For removing all after the specific character such as comma, please type ,* into the Find what text box;

Notes:

1. You can change the comma to any character as you need.

2. In this case, all texts before the last comma or after the first comma will be removed from the selected cells.

2. Keep the Replace with text box empty, and then click the Replace All button. See screenshot:


Easily remove all numeric, non-numeric or specified characters from cells in Excel

Kutools for Excel's Remove Character utility helps you easily remove all numeric, non-numeric or specified characters from selected cells in Excel.
Download the full feature 30-day free trail of Kutools for Excel now!


Delete texts before or after the first/last specific character by formula

This section will show you formulas of deleting everything before or after the first/last specific character from cells in Excel.

To remove everything before the first comma, please:

Select a blank cell, copy and paste the below formula into it, and press Enter key. Then drag the Fill Handle to apply the formula to other cells. See screenshot:

Formula: Remove everything before the first comma

=RIGHT(B5,LEN(B5)-FIND(",",B5))

Notes:

1. In the above formula, B5 is the cell you will remove texts from, and "," is the character you will remove texts based on.

2. To remove all before the last specific character, use this formula:

=RIGHT(B5,LEN(B5)-FIND("@",SUBSTITUTE(B5,"Character","@",(LEN(B5)-LEN(SUBSTITUTE(B5,"Character","")))/LEN("Character"))))

To remove everything after the first comma, please:

Select a blank cell, copy and paste the below formula into it, and press Enter key. Then drag the Fill Handle to apply the formula to other cells. See screenshot:

Formula: Remove everything after the first comma

=LEFT(B5,FIND(",",B5)-1)

Notes:

1. In the above formula, B5 is the cell you will remove texts from, and "," is the character you will remove texts based on.

2. To remove all after the last specific character, use this formula:

=LEFT(B5,FIND("@",SUBSTITUTE(B5,"character","@",LEN(B5)-LEN(SUBSTITUTE(B5,"character",""))))-1)


Delete texts before or after the nth occurrence character by formula

The below formulas can help to delete all before or after the nth occurrence character from cells in Excel.

To remove all before the nth occurrence character from cells, you need to:

Select a blank cell to output the result, copy the below formula into it, and press Enter key. Then drag the Fill Handle to apply the formula to other cells. See screenshot:

Formula: Remove everything before the second occurrence comma

=RIGHT(SUBSTITUTE(B5, ",", CHAR(9), 2), LEN(B5)- FIND(CHAR(9), SUBSTITUTE(B5, ",", CHAR(9), 2), 1) + 1)

Notes:

1. In the formulas, B5, "," and 2 number mean that all contents after the second occurrence comma will be removed from cell B5.

2. You can change the "," and 2 number to any character and occurrence position number as you need.

To remove all after the nth occurrence character from cells, you need to:

Select a blank cell to output the result, copy the below formula into it, and press Enter key. Then drag the Fill Handle to apply the formula to other cells. See screenshot:


Formula: Remove everything after the second occurrence comma

=LEFT(SUBSTITUTE(B5,",",CHAR(9),2),FIND(CHAR(9),SUBSTITUTE(B5,",",CHAR(9),2),1)-1)

Notes:

1. In the formulas, B5, "," and 2 number mean that all contents after the second occurrence comma will be removed from cell A7.

2. You can change the "," and 2 number to any character and occurrence position number as you need.


Easily remove texts before/after a specific character with Kutools for Excel

If there is only one comma separator for each cell in a range, and you want to remove everything before or after this comma from cells, please try the Split Cells utility of Kutools for Excel. This utility will help you to solve the problem with only several clicks:

1. Select the cells which you will remove everything before or after the comma from, and then click Kutools > Text > Split Cells. See screenshot:

2. In the Split Cells dialog, select the Split to Columns option in the Type section, and in the Split by section, choose the Other option and type a comma into the blank box, and then click the OK button. See screenshot:

3. Another Split Cells dialog pops up, select a blank cell for locating the texts, and then click the OK button.

Then you can see the selected cells are split by specific character – comma. See screenshot:

  If you want to have a free trial (30-day) of this utility, please click to download it, and then go to apply the operation according above steps.


Kutools for Excel - Helps You Always Finish Work Ahead of Time, Have More Time to Enjoy Life
Do you often find yourself playing catch-up with work, lack of time to spend for yourself and family?  Kutools for Excel can help you to deal with 80% Excel puzzles and improve 80% work efficiency, give you more time to take care of family and enjoy life.
300 advanced tools for 1500 work scenarios, make your job so much easier than ever.
No longer need memorizing formulas and VBA codes, give your brain a rest from now on.
Complicated and repeated operations can be done a one-time processing in seconds.
Reduce thousands of keyboard & mouse operations every day, say goodbye to occupational diseases now.
Become an Excel expert in 3 minutes, help you quickly get recognized and a pay raise promotion.
110,000 highly effective people and 300+ world-renowned companies' choice.
Make your $39.0 worth more than $4000.0 training of others.
Full feature free trial 30-day. 60-Day Money Back Guarantee without reason.

Comments (60)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
السلام عليكم كيفكم اسمي احمد ابراهيم محمد علامي من ذوي الاعاقة اصم وابكم الثانوية وحاسوب من الرياض جازان صبيا رقم جوالي قديم اشويه 0501601641 ابغي مساعدة فايدة وشكرا لكم جميعا أن شاءالله
This comment was minimized by the moderator on the site
رقمي 0501601641 وشكرا لكم جميعا أن شاءالله السلام عليكم كيفكم اسمي احمد ابراهيم محمد علامي
This comment was minimized by the moderator on the site
Hi how can i split or add spacing in between each textRoominCoolDecoApartmentinBrunswickEast
This comment was minimized by the moderator on the site
Hi z,If every word in the sentence starts with a capital letter, you can try one of the methods below to get it done:1. To add space between each word, methods in this article can do you a favor:How To Insert Spaces Before Capital Letters In Excel?
https://www.extendoffice.com/documents/excel/1864-excel-insert-space-before-capital-letter.html

2. To split text by capital letter in the sentence, you can try the methods in this article.How To Split Text Into Separate Columns By Capital Letter In Excel?
https://www.extendoffice.com/documents/excel/3336-excel-split-text-by-capital-letter.html
This comment was minimized by the moderator on the site
Hi I have the next text:

/credit-loan/super-credit/- from 1251 to 1016( -18.78%)
/credit-loan/no-credit/- from 1018 to 703( -30.94%)
/loan-loan-credit-cards- from 773 to 633( -18.11%)
/loan-loan/fair-loan/- from 321 to 502( -29.69%)

I need to delete everything after "-" before the from, including the character "-" so the above to become:

/credit-loan/super-credit/
/credit-loan/no-credit/
/loan-loan-credit-cards
/loan-loan/fair-loan/

And after I would also need to have the above without the "/" as in (but I think I can manage that later):

/credit-loan/super-credit
/credit-loan/no-credit
/loan-loan-credit-cards
/loan-loan/fair-loan
This comment was minimized by the moderator on the site
Hiimy texts is following
Execution/428/2019DOI:05-07-20192 years 5 months 4
daysCompliance23-09-2019

I want to delete whole texts after DOI:
This comment was minimized by the moderator on the site
Hi I have the next text:
/credit-loan/super-credit/- from 1251 to 1016( -18.78%)
/credit-loan/no-credit/- from 1018 to 703( -30.94%)
/loan-loan-credit-cards- from 773 to 633( -18.11%)
/loan-loan/fair-loan/- from 321 to 502( -29.69%)

I need to delete everything after "-" before the from, including the character "-" so the above to become:
/credit-loan/super-credit/
/credit-loan/no-credit/
/loan-loan-credit-cards
/loan-loan/fair-loan/

And after I would also need to have the above without the "/" as in (but I think I can manage that later):
/credit-loan/super-credit
/credit-loan/no-credit
/loan-loan-credit-cards
/loan-loan/fair-loan
This comment was minimized by the moderator on the site
Thank you!
This comment was minimized by the moderator on the site
What is the formula to keep only 160USCAIRAPPW01 in below excel spreadsheet?

16780187,160-USC-NOV-Updates-Server,160 - ALL LAC+USC Servers,160USCAIRAPPW01,Non-compliant,11/23/2019 11:33 AM,,,,,,16891741,Non-compliant,0X00000000,Success,11/23/2019 11:22 AM,(SYSTEM),Yes,No,Yes,
This comment was minimized by the moderator on the site
remove everything before
the last hyphen?
BABU RAM (622)
JAGAN NATH
This comment was minimized by the moderator on the site
I have: E4U19-31C20010093021EI 3032AER LINGUS 190805000010. I need to remove everything before the first space and everything after the last space but I need to keep the spaces. I have this formula but it removes the spaces: =LEFT(RIGHT(A19,LEN(A19)-FIND(" ",A19)),FIND("^^",SUBSTITUTE(RIGHT(A19,LEN(A19)-FIND(" ",A19))," ","^^",LEN(RIGHT(A19,LEN(A19)-FIND(" ",A19)))-LEN(SUBSTITUTE(RIGHT(A19,LEN(A19)-FIND(" ",A19))," ",""))))-1)
This comment was minimized by the moderator on the site
Hi, please try this formula:
=LEFT(RIGHT(B9,LEN(B9)-FIND(" ",B9)+1),FIND("^^",SUBSTITUTE(RIGHT(B9,LEN(B9)-FIND(" ",B9))," ","^^",LEN(RIGHT(B9,LEN(B9)-FIND(" ",B9)))-LEN(SUBSTITUTE(RIGHT(B9,LEN(B9)-FIND(" ",B9))," ",""))))-1)
This comment was minimized by the moderator on the site
Great buddy. Too much helpful post.
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations