Combining first two letters from first name and first two letters from last name

Yes; assuming each person only has a First and Last name, and this is always separated by a space you can use the below:

=LEFT(A1,2)&MID(A1,SEARCH(" ",A1)+1,2)

I could only base this answer on those assumptions as it is all you provided.

Or if you want a space to still be included:

=LEFT(A1,2)&" "&MID(A1,SEARCH(" ",A1)+1,2)

And to round things out, here's a solution that will return the first two characters of the first name, and the first two characters of the last name, but also accounts for middle names.

=LEFT(A1,2)&LEFT(MID(A1,FIND("~~~~~",SUBSTITUTE(A1," ","~~~~~",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))+1,LEN(A1)),2)

enter image description here

Thanks to @Kyle for the main part of the formula


This is another way...

Screenshot of worksheet

  • A - Name
  • B - =CONCATENATE(LEFT(A1,2),LEFT(RIGHT(A1,(LEN(A1)-FIND(" ",A1))),2))

First off, I'd like to say that PeterH's answer is the simplest and easiest to understand. (Although my preference is to use FIND() instead of SEARCH() - typing two less characters helps in avoiding RSI ;-) )

An alternative answer that neither uses MID(), LEFT() nor RIGHT(), but instead uses REPLACE() to remove the unwanted parts of the name is as follows:

=REPLACE(REPLACE(A1,FIND(" ",A1)+3,LEN(A1),""),3,FIND(" ",A1)-2,"")

Explanation:

The inner REPLACE(A1, FIND(" ",A1)+3, LEN(A1), "") removes the characters from the third character of the last name onward, whilst the outer REPLACE(inner_replace, 3, FIND(" ",A1)-2, "") removes the characters from the third character of the first name up to and including the space.


Addendum 1:

The above formula can also be adapted to allow for a single middle name:

=REPLACE(REPLACE(A1,IFERROR(FIND(" ",A1,FIND(" ",A1)+1),FIND(" ",A1))+3,LEN(A1),""),3,IFERROR(FIND(" ",A1,FIND(" ",A1)+1),FIND(" ",A1))-2,"")

by replacing FIND(" ",A1) with IFERROR(FIND(" ",A1,FIND(" ",A1)+1), FIND(" ",A1)).

FIND(" ", A1, FIND(" ",A1)+1) finds the second space (by starting the search for the space after the first space) or errors otherwise.
IFERROR(find_second_space, FIND(" ",A1)) finds the first space if there is no second space.


This (long-winded) version allows for any number of middle names:

=REPLACE(REPLACE(A1,FIND("§",SUBSTITUTE(A1," ","§",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))+3,LEN(A1),""),3,FIND("§",SUBSTITUTE(A1," ","§",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))-2,"")

In this case FIND(" ",A1) is replaced with FIND("§", SUBSTITUTE(A1," ","§",LEN(A1)-LEN(SUBSTITUTE(A1," ","")))).

LEN(A1)-LEN(SUBSTITUTE(A1," ","")) counts the number of spaces.
SUBSTITUTE(A1, " ", "§", count_of_spaces) replaces the last space with §.
FIND("§", last_space_replaced_string) finds the first § which is the same as finding the last space.

(The § could, of course, be replaced with any character guaranteed not to exist in the full name string. A more general, safer alternative would be to use CHAR(1). )


Note that, of course, BruceWayne's answer is the simplest and easiest to understand solution that allows for any number of middle names. Well it was. Until I posted my other answer, that is ;-)


Addendum 2:

All of the solutions can be adapted to cater for the case of a single name only (if there's a requirement for a four character result) by wrapping them within an IFERROR() function like so:

=IFERROR(solution, alternate_formula)

Note that the above is a general case formula, and it might be possible to make a more efficient modification to a specific solution. For example, if the requirement in the case of a single name is to join the first two letters with the last two letters, PeterH's answer can be more efficiently adapted in this way:

=LEFT(A1,2)&MID(A1,IFERROR(SEARCH(" ",A1)+1,LEN(A1)-1),2)


To allow for the case of a single letter first name or an initial (assuming a space or dot is not acceptable as the second character) the following can be used with any solution:

=SUBSTITUTE(SUBSTITUTE(solution, " ", single_char), ".", single_char))

Note that the single character can be either hard-coded or calculated from the name. (Or use "" to remove the space or dot.)


Finally, if you really need to cater for the case where the full name is a single character only(!), just wrap the single-name-only formula with another IFERROR(). (Assuming, of course, that the alternate formula doesn't take care of that special case.)


Addendum 3:

Finally, finally (no, really* ;-) ) to cater for multiple consecutive and/or leading/trailing spaces, use TRIM(A1) instead of A1.


* I'll leave the case for a single letter last name, like Mr T, as an exercise for the reader.

Hint: =solution &IF(MID(A1,LEN(A1)-1,1)=" ", single_char, "")