Creating Alpha Numeric Code by Last Name

jg10009

New Member
Joined
Feb 26, 2010
Messages
21
I'm trying to create an alpha numeric code for a massive list of direct mail recipients compiled in excel. The code would be [first letter of last name]&"_"&[number 1-10,000 based on alpha order within specific letter (see below)]. Examples below. I can figure out the first letter with left but can't figure out how to restart the count based on the switch from A to B, B to C, etc. This can be done manually obviously but I'd prefer to not have to do that each time I update the list it! Please help!


CodeFirst NameLast Name
A_1JohnAdams
A_2John QuincyAdams
A_3ChesterArthur
B_1JamesBuchanan
C_1JimmyCarter
C_2GroverCleveland
C_3GroverCleveland
C_4BillClinton
C_5CalvinCoolidge
E_1DwightEisenhower
F_1MillardFillmore
F_2GeraldFord

<colgroup><col><col><col></colgroup><tbody>
</tbody>
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
try this:
=IF(LEFT(C3,1)=LEFT(C2,1),LEFT(C3,1) & "_" & MID(A2,3,255)+1,LEFT(C3,1) & "_1")

I forgot to say you need to put A_1 into the cell A2
 
Last edited:
Upvote 0
Assuming you have header text in Row 1 and that your data starts on Row 2, put this formula in cell A2 and copy it down...

=LEFT(C2)&"_"&COUNTIF(C$1:C1,LEFT(C2)&"*")+1
 
Upvote 0
dosen't that code have to be a permanent fixture? others wise your next references will be out
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,484
Members
448,967
Latest member
visheshkotha

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