logo
search
Function Problems

How to Create Unique Employee IDs in Excel with Formulas

Tauseeq MagsiTauseeq Magsi Oct 10, 2026 871 views

Question details

The user needs to create unique employee IDs in a spreadsheet by dynamically combining initials extracted from the employee's name with numbers derived from their start date.

How to Create Unique Employee IDs in Excel with Formulas
Product
Excel
Device & OS
not provided
Scenario
Managing HR or employee records and needing to auto-generate unique identification codes based on existing personnel data.
Observed behavior
Requires a specific combination of text and date functions to dynamically construct a unique string for each employee without manual data entry.
Before you start

Ensure your spreadsheet has separate columns for the employee's full name (e.g., Column A) and their start date (e.g., Column B), and verify that the date column is formatted properly as Date values.

Solution 1Recommended

Use a Combined Text and Date Formula to Generate the ID

This method extracts the first and last initials from a full name and appends a formatted start date alongside a unique sequence number.

By nesting functions like LEFT, MID, FIND, and TEXT together, you can pull specific characters from strings and format numerical values into a cohesive, unique ID.

1
Select the target cell

Click on the empty cell in your Employee ID column (e.g., C2) where you want the first code to appear.

2
Enter the combination formula

Type the formula: =LEFT(A2,1)&MID(A2,FIND(" ",A2)+1,1)&YEAR(B2)-2000&TEXT(COUNTIFS($B$2:B2,">="&DATE(YEAR(B2),1,1),$B$2:B2,"<="&DATE(YEAR(B2),12,31)),"0000") and press Enter.

3
Auto-fill the remaining rows

Hover your mouse over the bottom-right corner of cell C2 until a plus icon appears, then double-click or drag it down to apply the formula to the rest of your employee list.

Use a Combined Text and Date Formula to Generate the ID
Formula Breakdown: LEFT extracts the first initial, MID and FIND extract the last initial after the space, YEAR subtracts 2000 to yield a two-digit year, and COUNTIFS adds a sequenced 4-digit number based on the entries in that specific year.
Efficient Spreadsheet Management

Generate Employee IDs Easily with WPS Spreadsheet

WPS Spreadsheet fully supports advanced text and date formulas, making it incredibly easy to automate your HR and employee data tasks. Generate complex unique IDs in seconds with an intuitive interface.

  1. 1. Open your data file: Launch WPS Office Spreadsheet and open your existing employee records document.
  2. 2. Apply the formula: Click the cell designated for the new ID and paste the combined text and date formula into the formula bar.
  3. 3. Auto-fill the column: Double-click the fill handle on the bottom-right corner of the cell to instantly generate IDs for all employees.
Fully compatible with Microsoft Excel (.xlsx) formats and standard formulasSupports over 400 advanced formulas including complex text and date functionsFree to use with a user-friendly, familiar interfaceLightweight and runs smoothly on Windows, Mac, and Linux
QA img-9

Frequently Asked Questions

What if the employee has a middle name?

The provided formula uses FIND(" ",A2) which locates the first space. If there is a middle name, it will extract the first letter of the middle name instead of the last name. To properly handle middle names, it is best to separate the full names into distinct First Name and Last Name columns, and then reference those separate cells in your formula.

Why is the formula returning a #VALUE! error?

This usually happens if the space character cannot be found (for example, a single-word name) or if the start date column contains text instead of actual date values. Ensure all names include a space and that your dates are correctly formatted as 'Date' types in the cell properties.

Can I add a custom prefix like 'EMP-' to all employee IDs?

Yes, you can easily add a constant prefix by placing it in quotation marks at the very beginning of the formula, followed by an ampersand (&). For example: ="EMP-"&LEFT(A2,1)&MID(A2,FIND(" ",A2)+1,1)...