Excel Sort

Posted on 2011-10-24
Medium Priority
Last Modified: 2013-11-05
I have a column that contains data in the format:

I want to sort on the Surname, Firstname. I don't care if the Alpha:Numeric. is deleted.
Question by:Won2Ok
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 37022101
Can you give a few examples here?
LVL 10

Expert Comment

ID: 37022128
Your best bet is to split the data into columns, then you'll have much more control for sorting. You can do so by clicking data, text to columns.

Accepted Solution

AgeOfEmpires earned 2000 total points
ID: 37022184
If this is the exact format of your data for every row, and you prefer not to use the text to columns (which would break out your data into multiple columns), you can leave the original data undisturbed and parse out Surname,Firstname is another column and sort on that column.  To parse the data (assuming your first Alpha:Numeric.Surname,Firstname is in cell A1) would be:


Now a couple of things about the above formula - it assumes that the first occurrence of a "." is 100% the divider between Alpha:Numeric and Surname,Firstname.  If Alpha:Numeric could contain a ".", this formula will break.  Also, the formula is a little kludgy since you use an artificially high number of 100 for the number of characters to grab after the "." is found.  If this threshold fits well within your data, great.  If not, you can increase it to a suitable number.  The logically clean way would be to calculate the position of the first "." again in the third term of the MID function and subtract that from the length(A1)-1.  However, cheating with an artificially high length let's you avoid those two additional calcs.

One note about my solution and the one offered by etech0 - if "." can occur one or more times to the left of the "." separator between Alpha:Numeric and Surname,Firstname, then you have a little more work to do.

Hope this helps.

Author Closing Comment

ID: 37022438

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question