# Abbreviate names or words

To abbreviate text that contains capital letters, you can try this array formula based on the TEXTJOIN function, a new function available in Office 365 and Excel 2019. You can use this approach to create initials from names, or to create acronyms. Only capital letters will survive this formula, so the source text must include capitalized words. You can use the PROPER function to capitalize words if needed.

In the example shown, the formula in C5 is:

### How this formula works

Working from the inside out, the MID function is used to cast the string into an array of individual letters:

In this part of the formula, MID, ROW, INDIRECT, and LEN are used to convert a string to an array or letters, as described here.

MID returns an array of all characters in the text.

{"W";"i";"l";"l";"i";"a";"m";" ";"S";"h";"a";"k";"e";"s";"p";"e";"a";"r";"e"}

This array is fed into the CODE function, which outputs an array of numeric ascii codes, one for each letter.

Separately, ROW and INDIRECT are used to create another numeric array:

This is the clever bit. The numbers 65 to 90 correspond to the ascii codes for all capital letters between A-Z. This array goes into the MATCH function as the lookup array, and the original array of ascii codes is provided as the lookup value.

MATCH then returns either a number (based on a position) or the #N/A error. Numbers represent capital letters, so the ISNUMBER function is used together with the IF function to filter results. Only characters whose ascii code is between 65 and 90 will make into the final array, which is then reassembled with the TEXTJOIN function to create the final abbreviation or acronym.

## Excel Formula Training

Formulas are the key to getting things done in Excel. In this accelerated training, you'll learn how to use formulas to manipulate text, work with dates and times, lookup values with VLOOKUP and INDEX & MATCH, count and sum with criteria, dynamically rank values, and create dynamic ranges. You'll also learn how to troubleshoot, trace errors, and fix problems. Instant access. See details here.