π Excel Formula Spotlight: First Name with Random Suffix Generator
Excel Trick: Extract First Name and Add Random Numbers Dynamically

If you're working in Excel and need a quick way to generate a custom identifier using a person's first name followed by a random number, this formula is a perfect solution.
π― What the Formula Does
=IF(ISNUMBER(SEARCH(" ", B2)), TEXTBEFORE(B2, " "), B2) & "@" & RANDBETWEEN(1000,99999)
It dynamically:
Extracts the first name from a full name in cell
B2,Appends an
"@"symbol,Adds a random number (between 1000 and 99999).
π Real-World Examples
| Full Name (B2) | Generated Output |
John Doe | John@27483 |
Asha | Asha@83917 |
Each time the sheet recalculates, the random number updates β great for generating unique, non-sensitive identifiers or temporary usernames.
π§ How It Works
SEARCH(" ", B2)β Looks for a space character in the cell (to check if there's a full name).ISNUMBER(...)β Returns TRUE if a space exists, meaning thereβs a full name.TEXTBEFORE(B2, " ")β Extracts the first name from the full name.B2β If no space is found (i.e., just a first name), returns the whole value."@" & RANDBETWEEN(1000,99999)β Adds an@and a random number between 1000 and 99999.
π οΈ Use Cases
Quickly generate test usernames like
Asha@54321Create non-personal unique IDs for events, forms, or demos
Lightweight way to pseudo-anonymize user data in Excel
π Tips
Want a fixed ID? Copy the result and use Paste Special β Values to lock it in.
You can increase randomness by extending the number range (e.g.,
100000to999999).
Thanks for reading.




