Truncating A Full Punctuated Name

DReinwald

New Member
Joined
Oct 4, 2019
Messages
3
I must, after pasting a long list of patient names, truncate to display only the first two letters of the last name, for privacy.

Beethoven, Ludwig V must become Be., Ludwig V

Doe, Jane X must become Do., Jane X

I've been using this:

=(LEFT(D66,2)&"."&","&(RIGHT(<wbr style="color: rgb(34, 34, 34); font-family: Arial, Helvetica, sans-serif; font-size: small; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;">
D66,8)))

but I'm more than a novice so I have to change that far right number over and over to make each name display properly.

Is a nesting of a LEFT/RIGHT the wrong approach?

Many thanks!

 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
51,771
Office Version
365
Platform
Windows
Welcome to the Board!

Try this:
Code:
=LEFT(D67,2) & "." & MID(D67,FIND(",",D67),LEN(D67))
 
Last edited:

alansidman

Well-known Member
Joined
Feb 26, 2007
Messages
5,097
Office Version
2019
Platform
Windows
Assumes your list is in Column A =LEFT(A1,2) & "." & "," & RIGHT(A1, LEN(A1)-FIND(",",A1)) and copy down.
 

DReinwald

New Member
Joined
Oct 4, 2019
Messages
3
That works Joe4. This month's reporting will go SO much faster.

I think I see that you've done what I don't know how to do. The comma informs the spacing and LEN appears to allow for specific length.

I thank you!!
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
51,771
Office Version
365
Platform
Windows
Basically, with the last part, I am using the FIND function to find where the comma starts.
I am then using the MID function on the original entry, telling it to start at the comma, and then just telling to go out the number of spaces to the right.
I am using the Length of the original function for that last part, which is a bigger number than I need, but it doesn't matter if it is too big.

For example, if I had a value like "DOUBLE" in cell A1, and wanted to return from the 4th character on, I could use:
=MID(A1,4,3) to return "BLE"
however
=MID(A1,4,6) also returns "BLE" (because there is nothing after the E).

We could figure out exactly how many spaces we need for that last argument, but it isn't necessary (since we are going to the end), as long as we choose some number that will always get us there.
 

DReinwald

New Member
Joined
Oct 4, 2019
Messages
3
alansidman:

That too! Works well. Thank you both - more than I can say. Will save me a lot of reworking it.
 

alansidman

Well-known Member
Joined
Feb 26, 2007
Messages
5,097
Office Version
2019
Platform
Windows
Thanks for the feedback.
 

Forum statistics

Threads
1,085,294
Messages
5,382,772
Members
401,804
Latest member
RB85

Some videos you may like

This Week's Hot Topics

Top