Spreadsheet Practice

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 to B7
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."

  1. A2"Maria Lopez"

    The value in A2.

  2. TEXTBEFORE(A2," ")"Maria"

    TEXTBEFORE: Text before a delimiter.

    • textA2"Maria Lopez"
    • delimiter" "
  3. TEXTBEFORE(A2," ")&" ""Maria "

    The & operator joins as text.

  4. -1-1

    Makes the value negative.

  5. TEXTAFTER(A2," ",-1)"Lopez"

    TEXTAFTER: Text after a delimiter.

    • textA2"Maria Lopez"
    • delimiter" "
    • instance_num-1-1
  6. LEFT(TEXTAFTER(A2," ",-1),1)"L"

    LEFT: Characters from the start of text.

    • textTEXTAFTER(A2," ",-1)"Lopez"
    • num_chars1
  7. TEXTBEFORE(A2," ")&" "&LEFT(TEXTAFTER(A2," ",-1),1)"Maria L"

    The & operator joins as text.

  8. 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.

FormulaResultWhen 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

In 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.