## How to create name initials

The array formula in cell C3 extracts the first character from first, middle and last name. The formula works fine with more or less names, up to 1000 characters. You can easily edit the formula if you need more letters.

Array formula in cell C3:

To enter an array formula, type the formula in a cell then press and hold CTRL + SHIFT simultaneously, now press Enter once. Release all keys.

The formula bar now shows the formula with a beginning and ending curly bracket telling you that you entered the formula successfully. Don't enter the curly brackets yourself.

### Explaining formula in cell C3

#### Step 1 - Split name into characters

The MID function returns characters from a text string based on a start number and the number of characters. The ROW function creates an array in this case that we need to split the text string into characters. The TRIM function removes leading and trailing spaces.

MID(" "&TRIM(B3), ROW($B$1:$B$1000), 1)

becomes

MID(" "&TRIM(B3), {1;2;3;4;5;6;7;8;9; ... ; 1000}, 1)

becomes

MID(" Atticus Esteban Griffith", {1;2;3;4;5;6;7;8;9; ... ; 1000}, 1)

and returns

{" ";"A";"t";"t";"i";"c";"u";"s";" "; "E";"s";"t";"e";"b"; "a";"n";" ";"G";"r"; "i";"f";"f";"i"; "t";"h";""; ... ;""}.

#### Step 2 - Check if a character is a space (blank)

The IF function replaces space characters with the next character.

IF(MID(" "&TRIM(B3), ROW($B$1:$B$1000), 1)=" ", " "&MID(TRIM(B3), ROW($B$1:$B$1000), 1), "")

becomes

IF({" ";"A";"t";"t";"i"; "c";"u";"s";" ";"E";"s"; "t";"e";"b";"a"; "n";" ";"G";"r"; "i";"f";"f";"i"; "t";"h";""; ... ;""}=" ", " "&MID(TRIM(B3), ROW($B$1:$B$1000), 1), "")

becomes

IF({TRUE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; TRUE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; TRUE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE}, " "&MID(TRIM(B3), ROW($B$1:$B$1000), 1), "")

becomes

IF({TRUE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; TRUE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; TRUE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; FALSE}, {" A"; " t"; " t"; " i"; " c"; " u"; " s"; " "; " E"; " s"; " t"; " e"; " b"; " a"; " n"; " "; " G"; " r"; " i"; " f"; " f"; " i"; " t"; " h"; ... ; " "}, "")

and returns

{" A";"";"";"";"";"";"";"";" E";"";"";"";"";"";"";"";" G";"";"";"";"";"";"";"";"";""; ... ; ""}

#### Step 3 - Concatenate characters

The TEXTJOIN function concatenates characters in an array and in this case ignoring empty array values.

TRIM(TEXTJOIN("", TRUE, IF(MID(" "&TRIM(B3), ROW($B$1:$B$1000), 1)=" ", " "&MID(TRIM(B3), ROW($B$1:$B$1000), 1), "")))

becomes

TRIM(TEXTJOIN("", TRUE, {" A";"";"";"";"";"";"";"";" E";"";"";"";"";"";"";"";" G";"";"";"";"";"";"";"";"";""; ... ; ""}))

becomes

TRIM(" A E G")

The TRIM function removes leading and trailing spaces.

TRIM(" A E G") returns "A E G" in cell C3.

### Download excel *.xlsx file

Extract table headers based on a condition

This article demonstrates an array formula that returns the table header based on a condition. For example, in cell C8 [โฆ]

Chirag asks: I want to separate numbers from the following text: Abc123bx45 as a result 123 and 45 should be [โฆ]

How to extract numbers from a cell value

The following array formula, demonstrated in cell C3, extracts all numbers from a cell value: =TEXTJOIN(, 1, TEXT(MID(B3, ROW($A$1:INDEX($A$1:$A$1000, LEN(B3))), [โฆ]

The formula in cell C3 grabs the first word in B3 using a blank as the delimiting character. =LEFT(B3,SEARCH(" ",B3)-1) [โฆ]

The LEFT function allows you to extract a string from a cell with a specific number of characters, however, if [โฆ]

Extract k-th word in cell value

The formula displayed above in cell range D3:D9 extracts a word based its position in a cell value. For example, [โฆ]

I this article I will show you how to get numerical values from a cell range manually and using an [โฆ]

The formula demonstrated above in cell range C3:C9 extracts the last word from adjacent cell in column B. =TRIM(RIGHT(SUBSTITUTE(B3, " [โฆ]

### 14 Responses to โHow to create name initialsโ

### Leave a Reply

### How to comment

**How to add a formula to your comment**

<code>Insert your formula here.</code>

**Convert less than and larger than signs**

Use html character entities instead of less than and larger than signs.

< becomes < and > becomes >

**How to add VBA code to your comment**

[vb 1="vbnet" language=","]

Put your VBA code here.

[/vb]

**How to add a picture to your comment:**

Upload picture to postimage.org or imgur

Paste image link to your comment.

**Contact Oscar**

You can contact me through this contact form

I have some shorter formulas for you...

Initials from first and last names

------------------------------------

=LEFT(TRIM(A2))&" "&MID(TRIM(A2),FIND(" ",TRIM(A2))+1,1)

Initials from first, middle and last names

-----------------------------------------------------------------

=TRIM(LEFT(TRIM(A2))&" "&LEFT(TRIM(MID(SUBSTITUTE(TRIM(A2)," ",REPT(" ",99)),100,99)))&" "&LEFT(TRIM(MID(SUBSTITUTE(TRIM(A2)," ",REPT(" ",99)),199,99)))&" "&LEFT(TRIM(MID(SUBSTITUTE(TRIM(A2)," ",REPT(" ",99)),298,99))))

Create middle name initials

---------------------------------------------------

=CHOOSE(LEN(TRIM(A2))-LEN(SUBSTITUTE(TRIM(A2)," ","")),TRIM(A2),SUBSTITUTE(TRIM(A2)&" "," "&TRIM(MID(SUBSTITUTE(TRIM(A2)," ",REPT(" ",99)),100,99))&" "," "&LEFT(TRIM(MID(SUBSTITUTE(TRIM(A2)," ",REPT(" ",99)),100,99)))&". "),SUBSTITUTE(SUBSTITUTE(TRIM(A2)&" "," "&TRIM(MID(SUBSTITUTE(TRIM(A2)," ",REPT(" ",99)),100,99))&" "," "&LEFT(TRIM(MID(SUBSTITUTE(TRIM(A2)," ",REPT(" ",99)),100,99)))&". ")," "&TRIM(MID(SUBSTITUTE(TRIM(A2)," ",REPT(" ",99)),199,99))&" "," "&LEFT(TRIM(MID(SUBSTITUTE(TRIM(A2)," ",REPT(" ",99)),199,99)))&". "))

My "Initials from first and last names" formula is only 3 characters shorter (taking advantage of the LEFT functions default behavior); however my "Initials from first, middle and last names" formula is about half the size of yours and my "Create middle name initials" formula is a little more than 60% the size of yours.

Rick Rothstein (MVP - Excel),

Great, they worked perfectly!

Thanks for posting!

[...] How to create initials from a list of first, middle and last names [Get Digital help] [...]

Oscar, have I got a treat for you. Assuming that there will never be any cells with more than four names in it, here is an amazingly short formula (considering what has been posted earlier) that I have just come up with...

=LEFT(A2,FIND(" ",A2))&IF(LEN(A2)-LEN(SUBSTITUTE(A2," ",""))>1,LEFT(TRIM(A3))&LEFT(TRIM(MID(SUBSTITUTE(A2," ",REPT(" ",99)),100,99)))&". ","")&IF(LEN(A2)-LEN(SUBSTITUTE(A2," ",""))=3,LEFT(TRIM(MID(SUBSTITUTE(A2," ",REPT(" ",99)),199,99)))&". ","")&TRIM(LEFT(RIGHT(SUBSTITUTE(" "&A2," ",REPT(" ",99)),99),99))

Sorry, I forgot to mention... the formula is for creating middle name initials.

Okay, in addition to the much shorter formula for creating middle name initials that I just posted above, here is a shorter formula for the initials from first, middle, last names as well...

=TRIM(LEFT(A2)&" "&LEFT(TRIM(MID(SUBSTITUTE(A2," ",REPT(" ",99)),100,99)))&" "&LEFT(TRIM(MID(SUBSTITUTE(A2," ",REPT(" ",99)),199,99))))

Rick Rothstein (MVP - Excel),

Thank you for commenting!

I canยดt get your formulas working, check out the attached file. Sheet 2 and column C and D.

Initialsv2.xlsx

I suspect wordpress removing characters.

@Oscar,

It looks like I had copied the wrong formula for the "creating middle name initials"... there was an A3 reference that should have been an A2 reference and there was an extra TRIM function call concatenated onto the part displaying the first initial... I remember having fixed both of those before posting, so I must have copied the wrong formula when I created my comment here. Sorry. Fixing those made the formula into the final form I meant to post, but that did not take care of all the problems though, as I did not account for extra leading and trailing spaces around the names (which is why the "initials from first, middle, last names" formula failed as well). Here are the fixed formula which should now work for you (longer than originally intended because of the added TRIM function calls to take care of the leading and trailing spaces, but still noticeably shorter than my previous short formulas from last year)...

Creating middle name initials

-----------------------------------------------------------

=LEFT(TRIM(A2),FIND(" ",TRIM(A2)))&IF(LEN(TRIM(A2))-LEN(SUBSTITUTE(TRIM(A2)," ",""))>1,LEFT(TRIM(MID(SUBSTITUTE(TRIM(A2)," ",REPT(" ",99)),100,99)))&". ","")&IF(LEN(TRIM(A2))-LEN(SUBSTITUTE(TRIM(A2)," ",""))=3,LEFT(TRIM(MID(SUBSTITUTE(TRIM(A2)," ",REPT(" ",99)),199,99)))&". ","")&TRIM(LEFT(RIGHT(SUBSTITUTE(" "&TRIM(A2)," ",REPT(" ",99)),99),99))

Initials from first, middle, last names

-----------------------------------------------------------

=TRIM(LEFT(TRIM(A2))&" "&LEFT(TRIM(MID(SUBSTITUTE(TRIM(A2)," ",REPT(" ",99)),100,99)))&" "&LEFT(TRIM(MID(SUBSTITUTE(TRIM(A2)," ",REPT(" ",99)),199,99))))

By the way, I noticed you had array-entered the formulas in the workbook you linked to in your last message... the above formulas do not need to be array-entered, they will work fine when normally entered.

Silly me... I have two occurances in my "Creating middle name initials" formula where I TRIM cell A2 only to then follow do that by removing all the spaces in cell A2. Removing those two unnecessary TRIM function calls shortens the formula by 12 characters without affecting the formulas ultimate action. Here is that revised formula...

=LEFT(TRIM(A2),FIND(" ",TRIM(A2)))&IF(LEN(TRIM(A2))-LEN(SUBSTITUTE(A2," ",""))>1,LEFT(TRIM(MID(SUBSTITUTE(TRIM(A2)," ",REPT(" ",99)),100,99)))&". ","")&IF(LEN(TRIM(A2))-LEN(SUBSTITUTE(A2," ",""))=3,LEFT(TRIM(MID(SUBSTITUTE(TRIM(A2)," ",REPT(" ",99)),199,99)))&". ","")&TRIM(LEFT(RIGHT(SUBSTITUTE(" "&TRIM(A2)," ",REPT(" ",99)),99),99))

Rick Rothstein (MVP - Excel),

I got your formulas working, thanks for posting!

[โฆ] How to create initials from a list of first, middle and last names [Get Digital help] [โฆ]

[โฆ] How to create initials from a list of first, middle and last names [Get Digital help] [โฆ]

[โฆ] How to create initials from a list of first, middle and last names [Get Digital help] [โฆ]

[โฆ] How to create initials from a list of first, middle and last names [Get Digital help] [โฆ]