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!

 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Welcome to the Board!

Try this:
Code:
=LEFT(D67,2) & "." & MID(D67,FIND(",",D67),LEN(D67))
 
Last edited:
Upvote 0
Assumes your list is in Column A =LEFT(A1,2) & "." & "," & RIGHT(A1, LEN(A1)-FIND(",",A1)) and copy down.
 
Upvote 0
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!!
 
Upvote 0
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.
 
Upvote 0
alansidman:

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

Forum statistics

Threads
1,224,823
Messages
6,181,176
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top