How to display first name and last initial in Excel
Excel formula
=TEXTBEFORE(A2," ")&" "&LEFT(TEXTAFTER(A2," ",-1),1)&"."Join the first word to the first letter of the last word: =TEXTBEFORE(A2," ")&" "&LEFT(TEXTAFTER(A2," ",-1),1)&"." gives "Maria L.".
- Result on the example
- one result per row in
B2, filled down toB7 - Works in
- Microsoft 365 only
- Google Sheets
- Different formula, see below
See it work
The formula is already in B2, filled down to B7. Change any input and the result updates, or edit the formula to experiment.
How it works
TEXTBEFORE returns the first name. TEXTAFTER with -1 returns the last name, and LEFT with 1 keeps its first letter. The period is added as text at the end. Using the last space means middle names are skipped.
=TEXTBEFORE(A2," ")&" "&LEFT(TEXTAFTER(A2," ",-1),1)&"."Result"Maria L."
A2"Maria Lopez"The value in A2.
TEXTBEFORE(A2," ")"Maria"TEXTBEFORE: Text before a delimiter.- text
A2"Maria Lopez" - delimiter
" "
- text
TEXTBEFORE(A2," ")&" ""Maria "The & operator joins as text.
-1-1Makes the value negative.
TEXTAFTER(A2," ",-1)"Lopez"TEXTAFTER: Text after a delimiter.- text
A2"Maria Lopez" - delimiter
" " - instance_num
-1-1
- text
LEFT(TEXTAFTER(A2," ",-1),1)"L"LEFT: Characters from the start of text.- text
TEXTAFTER(A2," ",-1)"Lopez" - num_chars
1
- text
TEXTBEFORE(A2," ")&" "&LEFT(TEXTAFTER(A2," ",-1),1)"Maria L"The & operator joins as text.
TEXTBEFORE(A2," ")&" "&LEFT(TEXTAFTER(A2," ",-1),1)&".""Maria L."The & operator joins as text.
In Google Sheets
Google Sheets needs a different formula: =LEFT(A2,FIND(" ",A2))&LEFT(REGEXEXTRACT(A2,"\S+$"),1)&".". On the same data it gives the same result. Here it is running in Google Sheets mode.
Other ways to do it
Each one was run on the same example sheet.
| Formula | Result | When to use it |
|---|---|---|
| =LEFT(A2,FIND(" ",A2))&LEFT(TRIM(RIGHT(SUBSTITUTE(A2," ",REPT(" ",100)),100)),1)&"." | Maria L., James O., Mary S.… | Works in every version: LEFT up to the first space keeps the first name and the space, and the last word comes from the SUBSTITUTE and REPT trick. |
Common mistakes
- Using the first space for the last name turns "Mary Ann Smith" into "Mary A.". Use the last space (instance -1).
- Two people can end up with the same display name ("Maria L." twice). Check with
=COUNTIF($B$2:$B$7,B2)>1.
Try it yourself
Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.
Display first name and last initial
B2, show the first name, a space, and the first letter of the last name followed by a period ("Maria L."). Fill down to B7.Questions
How do I show the first initial and last name instead?
Swap the parts: =LEFT(A2,1)&". "&TEXTAFTER(A2," ",-1) gives "M. Lopez".
How do I do it when first and last names are in separate columns?
Use =A2&" "&LEFT(B2,1)&".".
Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.