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!
[TABLE="width: 230"]
<colgroup><col><col><col></colgroup><tbody>[TR]
[TD]Code[/TD]
[TD]First Name[/TD]
[TD]Last Name[/TD]
[/TR]
[TR]
[TD]A_1[/TD]
[TD]John[/TD]
[TD]Adams[/TD]
[/TR]
[TR]
[TD]A_2[/TD]
[TD]John Quincy[/TD]
[TD]Adams[/TD]
[/TR]
[TR]
[TD]A_3[/TD]
[TD]Chester[/TD]
[TD]Arthur[/TD]
[/TR]
[TR]
[TD]B_1[/TD]
[TD]James[/TD]
[TD]Buchanan[/TD]
[/TR]
[TR]
[TD]C_1[/TD]
[TD]Jimmy[/TD]
[TD]Carter[/TD]
[/TR]
[TR]
[TD]C_2[/TD]
[TD]Grover[/TD]
[TD]Cleveland[/TD]
[/TR]
[TR]
[TD]C_3[/TD]
[TD]Grover[/TD]
[TD]Cleveland[/TD]
[/TR]
[TR]
[TD]C_4[/TD]
[TD]Bill[/TD]
[TD]Clinton[/TD]
[/TR]
[TR]
[TD]C_5[/TD]
[TD]Calvin[/TD]
[TD]Coolidge[/TD]
[/TR]
[TR]
[TD]E_1[/TD]
[TD]Dwight[/TD]
[TD]Eisenhower[/TD]
[/TR]
[TR]
[TD]F_1[/TD]
[TD]Millard[/TD]
[TD]Fillmore[/TD]
[/TR]
[TR]
[TD]F_2[/TD]
[TD]Gerald[/TD]
[TD]Ford[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 230"]
<colgroup><col><col><col></colgroup><tbody>[TR]
[TD]Code[/TD]
[TD]First Name[/TD]
[TD]Last Name[/TD]
[/TR]
[TR]
[TD]A_1[/TD]
[TD]John[/TD]
[TD]Adams[/TD]
[/TR]
[TR]
[TD]A_2[/TD]
[TD]John Quincy[/TD]
[TD]Adams[/TD]
[/TR]
[TR]
[TD]A_3[/TD]
[TD]Chester[/TD]
[TD]Arthur[/TD]
[/TR]
[TR]
[TD]B_1[/TD]
[TD]James[/TD]
[TD]Buchanan[/TD]
[/TR]
[TR]
[TD]C_1[/TD]
[TD]Jimmy[/TD]
[TD]Carter[/TD]
[/TR]
[TR]
[TD]C_2[/TD]
[TD]Grover[/TD]
[TD]Cleveland[/TD]
[/TR]
[TR]
[TD]C_3[/TD]
[TD]Grover[/TD]
[TD]Cleveland[/TD]
[/TR]
[TR]
[TD]C_4[/TD]
[TD]Bill[/TD]
[TD]Clinton[/TD]
[/TR]
[TR]
[TD]C_5[/TD]
[TD]Calvin[/TD]
[TD]Coolidge[/TD]
[/TR]
[TR]
[TD]E_1[/TD]
[TD]Dwight[/TD]
[TD]Eisenhower[/TD]
[/TR]
[TR]
[TD]F_1[/TD]
[TD]Millard[/TD]
[TD]Fillmore[/TD]
[/TR]
[TR]
[TD]F_2[/TD]
[TD]Gerald[/TD]
[TD]Ford[/TD]
[/TR]
</tbody>[/TABLE]