Sort Excel 2016 Rows Using a Custom Formula: A Comprehensive Guide

Abstract: Sort Excel 2016 rows by custom criteria using helper columns and the legacy Sort dialog since dynamic array functions are unavailable.

Created: 2026-08-31 by

Sorting Excel 2016 rows by a custom formula requires using the SORT function is not possible as it is exclusive to newer versions. Instead, you must leverage the legacy Sort dialog combined with a helper column that uses functions like MID, FIND, or LEFT to extract specific characters for ranking. This approach ensures your data orders correctly based on complex criteria without relying on non-existent dynamic array features.

Understanding the Limitation in Excel 2016

Many modern tutorials suggest using the SORTBY function to sort data based on another range. However, this function was introduced in Microsoft 365 and Excel 2021. If you are using Excel 2016, attempting to enter =SORTBY(A2:B10, C2:C10) will result in a #NAME? error. The engine simply does not recognize the function name. Therefore, the strategy shifts from dynamic array formulas to static helper columns. A helper column acts as an intermediary layer that calculates the sort key for each row, allowing the standard sorting tools to process the data accurately.

Creating a Helper Column for Letter-Based Sorting

To sort rows based on one or multiple letters within a string, you first need to isolate those letters into a new column. Suppose you have a list of product codes in column A (e.g., "Item-A", "Item-B") and you want to sort them alphabetically by the letter following the hyphen. You can create a helper column in column B. In cell B2, enter a formula that extracts the relevant character. For example, if the letter is always at the fifth position, use:
=MID(A2, 5, 1)
This formula starts at the fifth character of cell A2 and extracts one character. If your sorting criteria involve multiple letters, such as sorting by the last two digits of a code, adjust the MID function parameters accordingly. Once you have populated this formula down the entire dataset, column B contains the raw values that determine the sort order. This method is robust because it works in all versions of Excel, including 2016, and does not break when new rows are added if you convert your range to a Table. For more information on managing tables effectively, see Retrieving Auto-updated Data Added to Table in Excel: A Comprehensive Guide.

Executing the Sort Operation

With the helper column populated, the next step is to apply the actual sort. Select any cell within your data range. Navigate to the Data tab on the Ribbon and click the Sort button. This opens the Sort dialog box. In the "Column" dropdown, select the header of your helper column (e.g., "SortKey"). Ensure the "Sort On" option is set to "Values" and choose either "A to Z" for ascending order or "Z to A" for descending order. It is critical to check the "My data has headers" box if your range includes header rows; otherwise, Excel may treat the first row of data as a header, potentially causing misalignment or errors in subsequent sorts. Click OK to apply the changes. Your main data in columns A and beyond will now rearrange itself according to the calculated values in column B.

Handling Multiple Sorting Criteria

Sometimes a single letter is not enough to define a unique order. You might need to sort primarily by one letter and secondarily by another. In Excel 2016, you can handle this by adding additional helper columns. Create a second helper column in C2 with a formula for the secondary criterion, such as:
=MID(A2, 7, 1)
Return to the Data tab and open the Sort dialog again. Add a second level by clicking "Add Level". Set the second condition to sort by the new helper column in column C. This creates a hierarchical sort where the primary key takes precedence. This multi-level approach mimics the behavior of complex dynamic sorting found in newer Excel versions but relies on explicit column management. If you frequently perform these operations, consider bookmarking How to Find Display Name List Names in Two Separate Columns in Excel: A Tech Support Guide for techniques on managing related data fields efficiently.

Maintaining Data Integrity After Sorting

Once sorted, you may wish to hide or delete the helper columns to clean up the worksheet. You can right-click the helper column header and select "Hide" to remove it from view without deleting the underlying logic. If you delete the column, remember that any future additions to your dataset will not automatically generate new sort keys unless you use an Excel Table structure. Converting your range to a Table (Ctrl+T) ensures that formulas in the helper column auto-fill as new rows are appended. This prevents the common issue where new data remains unsorted or out of order. Additionally, if you are moving data between sheets during this process, refer to How to Copy Range of Cells from Excel Sheet B to Sheet A (Case A1) to ensure your references remain intact.

Frequently Asked Questions

Can I use VBA to sort by custom formula in Excel 2016?

Yes, you can write a VBA macro to evaluate a formula and sort the range programmatically. However, using a helper column with standard functions is generally faster and easier to maintain for most users. VBA requires enabling macros and understanding basic scripting, which adds unnecessary complexity for simple sorting tasks.

What happens if my text contains numbers instead of letters?

The MID and FIND functions work equally well with numeric characters. If you are extracting numbers, Excel will treat them as text strings during the sort. To ensure numerical sorting rather than alphabetical (where "10" comes before "2"), you should wrap your extraction formula in the -- operator or use VALUE() to coerce the text into a number.

Does hiding the helper column affect the sort order?

No, hiding a column only changes its visual presentation. The underlying data remains part of the selected range used for sorting. As long as the helper column is included in the original selection or the source table, Excel will use its values to determine the final arrangement of the visible data.

Why did my sort reorder other columns incorrectly?

This usually occurs when the "Expand the selection" option is not chosen during the sort process. Always ensure that all related columns move together. If you selected only the helper column before clicking Sort, Excel might ask whether to expand the selection. Choose "Expand the selection" to keep associated data aligned with their respective keys.

Is there a way to avoid helper columns entirely?

In Excel 2016, avoiding helper columns for complex custom sorting is difficult. While you can use advanced filtering, it does not persistently sort the data. The helper column method is the most reliable native workaround until you upgrade to a version that supports dynamic array sorting functions.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More