English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I have a list of names formatted:
Last Name, First Name, MI.

in MS Excel. Is it possible for Excel to format them into an eight letter string with the first six of the last name, then first initial, then middle initial.

i.e.

Answers, Yahoo G. becomes answeryg

if a last name is less than six characters, the first name is used to fill the space

Smith, Ryan B. becomes smithryb

2007-02-06 03:16:02 · 5 answers · asked by richard_f_schmidt 1 in Computers & Internet Software

I have a list of names formatted:
Last Name, First Name, MI.

in MS Excel. Is it possible for Excel to format them into an eight letter string with the first six of the last name, then first initial, then middle initial.

i.e.

Answers, Yahoo G. becomes answeryg

if a last name is less than six characters, the first name is used to fill the space

Smith, Ryan B. becomes smithryb

Also, I should have mentioned, these are all in one cell

2007-02-06 03:28:57 · update #1

5 answers

Try this formula:

=MID(A1,1,6) & MID(B1,1,2) & MID(C1,1,1)

That covers the first part easily by taking the Cell (A1) start from the first character (,1) and going 6 characters into the string (,6).
If middle is always just an initial instead of middle name you can just use C1 instead of MID(C1,1,1)

The second part with a short last name is trickier..it involves trimming and checking the length of the first string in a conditional statement like:

If LEN(MID(A1,1,6).TRIM) < 6 then
X = 6 - LEN(MID(A1,1,6).TRIM) + 2
End If

In your example, SMITH, the length of the string after trimming the space off the end is 5.
6-5 = 1 + 2 = 3 so X = 3

Put the X in for length of the first name string so you use 3 characters instead of 2 like:

=MID(A1,1,6) & MID(B1,1,X) & MID(C1,1,1)

The conditional will have to go in VBA code behind the scenes instead of in the cell like the original formula.

Hope that helps

2007-02-06 03:38:22 · answer #1 · answered by rod 6 · 0 0

The constant factor is the space before the initials. You can use the find() string to locate the first space character and the second one. The letter after the spaces are the initials. You now got that. Whatever in front of the first space is the first word. Truncate that to eight character if neccessary. Join them.

2007-02-06 14:33:03 · answer #2 · answered by unnga 6 · 0 0

Assuming you have Last, First, Middle in cells A1,A2,and A3:

= (LEFT (A1,6) & LEFT (B1,1) & LEFT (C1,1) )

Get rid of the spaces - had to add so Yahoo would show the whole thing.

Breaks down to:

Starting from LEFT side grab first 6 characters
Starting from LEFT side grab first 1 character
Starting from LEFT side grab first 1 character

2007-02-06 03:24:23 · answer #3 · answered by wyntre_2000 5 · 0 0

Yes it is possible

Use the CONCATENATE, and LEFT functions and write conditional statements to handle the issue of less than 8 characters in last name.

2007-02-06 03:43:59 · answer #4 · answered by TKE 1 · 0 0

i'm a database administrator (excel nerd). there is no thanks to insert both textual content and a function calculation (equation) right into a cellular. you are able to in spite of the undeniable fact that insert it right into a cellular next to the single containing textual content. you are able to format it in the variety of fashion that it would want to look as if one cellular. I.E. - same colour, get rid of border, justify the textual content, etc. wish this permits!

2016-10-17 05:40:00 · answer #5 · answered by Anonymous · 0 0

fedest.com, questions and answers