The issue you're facing is due to Excel treating your entries as alphanumeric text instead of numbers, which leads to lexicographical (text-based) sorting instead of numerical sorting. That’s why A1, A10, A11, A12, etc. appear before A2, A3, etc.
Method 1: Use a helper column to extract numeric values
- Insert a new column (e.g., Column D) next to your "Ref" column.
- Use the following formula in cell D2 (assuming "Ref" values start from A2):
=IF(ISNUMBER(VALUE(MID(A2,2,99))), VALUE(MID(A2,2,99)), 9999)
- This extracts the numeric portion after the letter "A", ignoring non-standard entries.
- If the entry is non-numeric (like "Ad"), it assigns 9999 to push it to the end.
- Drag the formula down for all rows.
- Sort the data using the helper column (Column D) in ascending order.
Method 2: Manual sorting using Excel's "Custom Sort"
- Select all data (including headers).
- Click "Sort & Filter" → "Custom Sort" (from the Data tab).
- Choose "Ref" as the column to sort by.
- In the Order dropdown, choose Custom List...
- Manually enter the correct order (
A1, A2, A3, A4...
etc.). - Click OK and then Sort.
If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.
hth
Marcin