Skip to playerSkip to main contentSkip to footer
  • 6/19/2025
Discover how you can use widlcard in Excel to get first name or last name.

In Excel, the asterisk symbol (*) is called a wildcard character. Wildcard characters are used as placeholders to match one or more characters in a text string.


When you use the "Find and Replace" function in Excel to find " *" (space followed by an asterisk), it will find all occurrences of that combination of characters after space, and replace them with whatever you specify, in this case a blank. Hence last name is retained.

Keep First Name
1) Ctrl+H
2) Find what as " *" (without double quotes)
3) Replace with as BLANK
4) Replace All

On the other hand, when you use the "Find and Replace" function in Excel to find "* " (asterisk followed by a space), it will find all occurrences of that combination of characters before the last space, and replace them with whatever you specify, in this case a blank as well. Hence last name is retained.

Keep Last Name
1) Ctrl+H
2) Find what as "* " (without double quotes)
3) Replace with as BLANK
4) Replace All

Just as a demo, if you use the "Find and Replace" function in Excel to find "*" (no spaces), everything is replaced with whatever you specify, in this case a blank as well.


Find and Replace,
Transcript
00:00In Excel, there are many ways to get only the first or the last name like using
00:03Flash Fill which has a hotkey of Ctrl-E and using combination of formulas
00:08like Left and Search. Let me show you another ingenious way to get only the
00:11first or the last name. On your spreadsheet, you'll be pressing the key
00:14Ctrl-H which opens a find and replace pop-up window here. To get the first
00:19name, all you have to do is you press space and asterisk and then replace with
00:24what? You just leave it blank and you click on replace all. You can see 201
00:29replacement was done and you can see only the first name are reserved. I'm gonna
00:32undo this guy here. To get only the last name, you press Ctrl-H again and in here
00:38this time around you're gonna press asterisk and space to find what and over
00:43here replace with you leave it blank and replace all and click on OK here you can
00:48see that only the last name is showing

Recommended