Skip to main content

Command Palette

Search for a command to run...

πŸ“Š Excel Formula Spotlight: First Name with Random Suffix Generator

Excel Trick: Extract First Name and Add Random Numbers Dynamically

Updated
β€’2 min read
πŸ“Š Excel Formula Spotlight: First Name with Random Suffix Generator

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 DoeJohn@27483
AshaAsha@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@54321

  • Create 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., 100000 to 999999).


Thanks for reading.

More from this blog

V

Vishal Mathur - IT Consultant and AI Prompt Engineer

29 posts

With over 9 years of experience as in IT, I have led technology operations across diverse industries, ensuring robust IT infrastructure, network security, and team development.