# Sorting by first two letters in first column then by text in second column

In my job, every day I receive excel file with 2 columns (A1, B2) of unsorted data. For example:

``````A1 B2
DD E
AA Y
CC C
AA W
CC B
CE I
AA P
CE C
DD Y
``````

What I wanted to do is to sort it first by 2 letters of cell in first column and then by text in second column. Like this:

``````A1 B2
AA P
AA W
AA Y
CC B
CC C
CE C
CE I
DD E
DD Y
``````

As you can see, text in B2 is sorted from A to Z, but within groups from A1 (AA, CC, CE, DD)

To be honest, I'm not very familiar with Excel. This kind of multiconditional sorting I need to create in some macro, vba?

I tried to use multisort option (sort by Column A, Sort on Values, order A to Z, then sort by Column B, Sort on Values, order A to Z) but it's not working how I wanted. Can somebody help me with this problem?

• Add a level to your sort (top left button in the sort window) – cybernetic.nomad Feb 14 at 19:40
• "I tried to use multisort option (sort by Column A, Sort on Values, order A to Z, then sort by Column B, Sort on Values, order A to Z) but it's not working how I wanted." How is it working? This will do what you are asking to do. – Alex M Feb 14 at 19:59
• Sorry, but after using that, it just sort all cells in B2, but destroy sorting in A1. Maybe I'm doing something wrong here? – Takaim Lys Feb 14 at 20:05
• You clearly are doing two sorts instead of adding a level to a single sort – cybernetic.nomad Feb 14 at 20:45
• If you want a sort to only take the first two characters in some cells into account, the easiest thing may be to have a helper column with said two letters – cybernetic.nomad Feb 14 at 21:12

in column C use the following formula `=left(A1,2)&B1` or whatever appropriate cell reference, then sort only by column C