To remove everything after a character in Excel, press Ctrl+H, enter that character followed by an asterisk in Find what, and enter the character alone in Replace with. For example, find ,* and replace with , to keep the first comma and delete the text after it; leave Replace with blank if you also want to remove the comma.
Use a wildcard in Find and Replace
Excel’s Find and Replace can use the asterisk (*) as a wildcard for any number of characters, including none. Put the character that marks the start of the unwanted text before the asterisk. Excel searches for that pattern within cell contents and replaces the matched text with what you enter in the replacement field.
- Select the cells you want to change, or leave the sheet unselected to search the whole worksheet.
- Press Ctrl+H on Windows. Alternatively, choose Home > Find & Select > Replace.
- In Find what, enter your delimiter followed by
*. For a comma, enter,*; for a hyphen, enter-*. - In Replace with, enter the delimiter if it should remain, or leave the box empty to remove it too.
- Choose Replace to check matches individually, or Replace All to change every match in the selected search scope.
On a Mac, Control+H opens Find and Replace in Excel; if the shortcut behaves differently in your setup, use Home > Find & Select > Replace. Excel for the web has Find and Replace too, though browser and keyboard settings can affect shortcuts. The ribbon command is a reliable alternative.
Example: keep the text before the first comma
Suppose A2 contains North,West,Extra. To keep North,, search for ,* and replace it with a comma. The comma marks where the unwanted section begins; the asterisk represents the rest of the cell’s text. Replacing the matched section with just a comma leaves the text before that first comma and the comma itself.
To keep only North, use the same Find what pattern and leave Replace with empty. The first comma is part of the matched text, so it is removed along with the characters after it. The comma is not an instruction to Excel; it is the actual character in the cell.
This is a direct edit, not a formula. Excel changes the cell contents, so use Replace first if you want to review individual matches. If you choose Replace All, the same rule applies to every matching cell in the search scope. For a large or important data set, make a copy of the worksheet or workbook before making a bulk change.
What the asterisk matches—and what it does not
The asterisk is a wildcard, not a literal asterisk. In a search pattern such as suffix*, Excel can match the text “suffix” and any characters that follow it. This makes the method useful for removing comments after a marker, trimming codes after a hyphen, or clearing notes after a label. It does not mean “the last occurrence” of a character; the pattern is found at the first matching point in the text.
Excel also recognizes the question mark (?) as a wildcard for one character. It is usually not the right tool for this job because the number of characters after your marker may vary. To find a literal asterisk, question mark, or tilde rather than use it as a wildcard, prefix it with a tilde: search for ~* to find an actual asterisk, for example. A tilde itself is represented by ~~.
To match text after a multi-character marker, put the whole marker before the asterisk. For example, if a cell contains Code: 81 / note: fragile and the desired cutoff is / note:, search for / note:*. Replacing with blank removes the marker and the note; replacing with the marker preserves it. Check a few real cells first, especially if the marker can appear as ordinary text elsewhere.
Choose the cells and search scope carefully
Before using Replace All, decide exactly what Excel should search. Selecting a range limits the operation to that selection; with no range selected, Excel searches the current worksheet. In the Find and Replace options, Within can be set to Sheet or Workbook, so a workbook-wide replacement may affect sheets you are not currently viewing.
Also review the search options. Match case can matter when the marker’s capitalization varies, and Match entire cell contents should generally be off for this task: the pattern is only part of a cell, not the entire cell. The Look in setting determines whether Excel searches formulas, values, or other cell content. If the cells contain formulas, be cautious: replacing text in a formula can alter the formula itself rather than merely changing its displayed result. Inspect the options in the dialog rather than assuming they are set for your data.
Use Find Next or Find All before a bulk replacement when you are unsure what the pattern will match. This is particularly useful when the marker occurs in a heading, an identifier, or a formula as well as in the text you intend to clean. Replace All may report how many replacements it made, but that count does not tell you whether every changed cell was appropriate.
Use a formula when you need a reviewable result
Find and Replace is convenient for a permanent edit, but it changes source data immediately. A formula in a helper column is better when you want to retain the original, compare results, or handle missing delimiters explicitly. TEXTBEFORE is available in Microsoft 365 and Excel 2024. With the original text in A2, this formula returns the part before the first comma and keeps the comma; if no comma exists, it returns the original text:
With the original text in A2, enter =IFERROR(TEXTBEFORE(A2,",")&",",A2). For North,West,Extra, the result is North,; for North, the result is North.
To remove the comma as well, use TEXTBEFORE without joining the comma back on. With the original text in A2, enter =IFERROR(TEXTBEFORE(A2,","),A2). It returns North for North,West,Extra, and returns North unchanged when there is no comma.
If you need the text after the first comma rather than the text before it, TEXTAFTER can return that portion. With the original text in A2, enter =IFERROR(TEXTAFTER(A2,","),""). For North,West,Extra, the result is West,Extra; when no comma is present, the formula returns a blank string. TEXTAFTER is available in Microsoft 365 and Excel 2024.
In older Excel versions without TEXTBEFORE, use LEFT and FIND. With the original text in A2, enter =IFERROR(LEFT(A2,FIND(",",A2)),A2). It returns North, for North,West,Extra, and North if no comma is found. Once you have checked the helper-column results, you can copy them and use Paste Special > Values if you want fixed text in place of the formulas. Keep the original column until you have verified the result.
When you need the last delimiter instead
A common misconception is that adding an asterisk makes Excel work backward from the end of a cell. It does not: a pattern such as ,* is suited to removing text from the first matching comma onward. If a value has several commas and you want to remove only the text after the last one, a simple Find and Replace pattern is not a dependable way to express that rule.
For last-delimiter cleanup, use a formula designed to identify the last occurrence, or split the text into parts and inspect the result before changing the original data. The exact formula depends on whether the delimiter is a comma, a space, or another string, and whether the delimiter itself should remain. TEXTBEFORE can use a negative instance number in Microsoft 365 or Excel 2024 to select an occurrence counted from the end, but missing delimiters still need a deliberate fallback. Test the formula on examples with one delimiter, several delimiters, and none.
Common problems and safe checks
- Nothing changes: Check for leading or trailing spaces around the marker, confirm the selected cells include the data, and review Within and Look in. A pattern that is not an exact match for the cell text will not find the intended point.
- Too much text disappears: The wildcard matches the remainder after the marker. Confirm that the marker is unique enough and use Replace to inspect a few matches before choosing Replace All.
- The delimiter disappears: That is expected if Replace with is blank. Enter the delimiter in the replacement field to retain it.
- Formulas change unexpectedly: Check Look in and avoid applying text replacement to formula cells unless changing formula text is intentional. A helper column is safer when the visible result comes from a formula.
- Only part of the workbook changes: Check whether the search scope is Sheet or Workbook and whether you selected a limited range.
Replacing text is not the same as splitting a column. If you need to keep both sides of a delimiter in separate cells, use Text to Columns or formulas rather than deleting one side. Likewise, if the cutoff marker varies from row to row, a formula that refers to a marker cell may be easier to maintain than a fixed Find and Replace pattern.
Frequently Asked Questions
How do I delete everything after a space in Excel?
Press Ctrl+H, put a space followed by an asterisk in Find what, and leave Replace with blank. This removes the first space and everything after it. To keep the space, put one space in Replace with instead.
Can Find and Replace keep the character before the deleted text?
Yes. Include the cutoff character in Find what, then enter that same character in Replace with. For instance, find -* and replace with - to keep the hyphen and remove what follows it.
Does * mean every character after the marker?
It means any number of characters in a wildcard search. In a pattern such as #*, it can match the marker and the following text. It is not a literal asterisk unless you escape it with a tilde.
Can I remove text after the last comma with Replace All?
Not reliably with the basic comma-and-asterisk pattern, which targets text from a matching comma onward rather than specifically selecting the last comma. Use a formula that identifies the final occurrence and verify the output first.
Can I undo Replace All?
In ordinary Excel editing, Ctrl+Z on Windows (Command+Z on Mac) usually undoes a recent replacement. However, do not rely on undo as your only safeguard, especially after other actions or when working with a shared or important file. Save a copy before a large cleanup.
Related
- Excel and Outlook Not Responding? Causes and Fixes
- Excel Page Breaks for Printing: How to Add Them Easily
- Excel Dropdown List: How to Select Multiple Items
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- How to Create Multiple Labels in Word, Step by StepTo create multiple labels in Microsoft Word, choose a label size, then either fill a sheet with the…
- Google Sheets Duplicate Data: Find and Remove ItYes. Google Sheets can find, highlight, and remove duplicate data: use Data > Data cleanup > Remove duplicates…
- How to Freeze a Cell in Excel Without Losing Your PlaceTo keep headings or identifiers visible while you scroll in Excel, select the cell just below and to…
- How to Create a Signature in OutlookTo create a signature in Outlook, open signature settings, write and format your sign-off, then choose whether Outlook…
- Excel Heatmap Shortcut: Fast Ways to Add Color ScalesExcel has no single dedicated key that instantly applies a heatmap, but on Windows the fastest ribbon sequence…
- Google Sheets UNIQUE Function: How to Find Distinct ValuesTo list distinct values in Google Sheets, enter =UNIQUE(A2:A) in an empty cell, replacing A2:A with your data…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.