Sort Names by Last Name in Excel Without Helper Columns

Sorting by last name in Excel is useful in various real-world scenarios, especially when managing lists of names in professional or organizational settings.

For example, if your organization generates email addresses based on last names, sorting by last name ensures consistency. Similarly, in HR databases or event registration lists, sorting by last name makes it easier to find individuals.

In this tutorial, I’ll show you how to sort names by last name in Excel using a formula—without relying on helper columns. We’ll use the SORTBY and REGEXEXTRACT functions. Since these functions are available in Excel 365 and later versions, check for compatibility before using them.

Sample Data

The sample data consists of ten names in B2:B11, though you can use this approach for a larger list.

Sample list of names for sorting by last name in Excel

We will apply the formula in C2 to arrange these names by last name in ascending order.

Formula to Sort by Last Name in Excel

Once your names are listed in B2:B11, use the following formula in C2:

=SORTBY(B2:B11, REGEXEXTRACT(B2:B11, "[^ ]+$"), 1)

This formula sorts the names by last name in ascending order.

Example of sorting names in ascending order by last name in Excel

If you want to sort by last name in descending order, simply replace 1 (the last argument) with -1:

=SORTBY(B2:B11, REGEXEXTRACT(B2:B11, "[^ ]+$"), -1)

Formula Explanation

1. Extracting the Last Name Using REGEXEXTRACT

=REGEXEXTRACT(B2:B11, "[^ ]+$")

This formula extracts the last name from each full name using a regular expression (REGEX).

Understanding the REGEX pattern

  • [^ ]: A negated character class that matches any character that is not a space.
  • +: A quantifier that matches one or more occurrences of non-space characters.
  • $: An anchor that matches the end of the string.

In simple terms, this pattern captures the last word (the last name) in each cell.

2. Using SORTBY to Sort the Names by Last Name

The SORTBY function sorts data dynamically based on another range.

Syntax of SORTBY:

=SORTBY(array, by_array1, [sort_order1], [by_array2, sort_order2], …)
  • array: The list of names to sort (B2:B11).
  • by_array1: The extracted last names (REGEXEXTRACT(B2:B11, "[^ ]+$")).
  • sort_order1: The sorting order (1 for ascending, -1 for descending).

This formula dynamically sorts the full names based on extracted last names.

Handling Trailing Zeros in the Sorted List

If you reference a larger range (e.g., B2:B100) and some rows are empty, the formula might return trailing zeros (0s) in the output.

To remove trailing zeros, use the following LET-based formula:

=LET(
   last_name, REGEXEXTRACT(B2:B100,"[^ ]+$"), 
   sorting, SORTBY(B2:B100,last_name,1), 
   IF(sorting=0,"",sorting)
)

How this works:

  • LET assigns the extracted last names to last_name.
  • The SORTBY function sorts the full names based on last_name.
  • IF(sorted_data=0, "", sorted_data) replaces any trailing zeros with blank cells.

Simply replace B2:B100 with the actual range containing names.

Conclusion

In this tutorial, you learned a formula-based approach to sorting names by last name in Excel—without using helper columns.

Key Benefits of This Method:

  1. No Helper Columns Needed – Works directly within a single formula.
  2. Dynamic Sorting – Automatically updates when new names are added.
  3. More Efficient – Avoids complex helper column workarounds.

If you need a static sorted list, copy the results, right-click > Paste Special > Values to preserve the order.

Additional Resources

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

How to Filter Multiple Columns in Google Sheets

This tutorial walks you through filtering multiple columns in Google Sheets using both the...

FLIP in Google Sheets – Custom Named Function to Reverse Data

The FLIP function lets you dynamically reverse the order of a row, column, or...

How to Flip a Row in Google Sheets

You can use the following formula to flip a row in Google Sheets while...

Filter the Bottom 10 Items in a Pivot Table in Google Sheets

This tutorial explains how to filter the bottom 10 items in a Pivot Table...

More like this

Hyperlink to Jump to the Last Used Row in Excel

In a vertical range, you can create a hyperlink to jump to the last...

Find the Last Used Row’s Last Value Address in Excel

In a large vertical dataset in Excel, how do you find the cell address...

Find the Last Used Row Number in Excel

When working with large datasets such as sales records, purchase data, or bills of...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.