sorting in excel - how do you do this?

I have an excel spread sheet with the last names of people in one column, and their corresponding first names in the next column. Is there any way to connect these two columns, so when I sort the last names in alphabetical order their first names will move with them?

Right now, when I sort the last names in column a, the first names in column b stay put. I’ve tried selecting both columns, but the sort result is not correct for the first names.

Is this possible?

In what way is it not correct for first names?

Selecting both columns, going to Data>Sort should then give you a box where you can sort by surnames and then by first names if that’s what you want.

I don’t know what happens, but the correct first name doesn’t go with its corresponding last name.

for example, in column B, I have Smith.

in column C, I have John

When I sort these two alphabetically, I’d like the entry Smith John show up in columns b and c in the correct spot in the alphabetically sorted list.

Usually this happens because you have only highlighted the one column, so Excel interprets that as “sort this column only, ignore the rest”.

To be safe, you should either click one cell in the worksheet and go to the Sort menu, or select the entire worksheet before going to the Sort menu.

Is that what you’re currently doing? Do your columns have headers?

as previously said highlight both columns when sorting on column a, and the entries in a & b should retain their relationship to each other

Make sure you tell it you don’t have a header row, or if it does have a header row, make sure it is included in the selection. If it thinks you have a header row and you don’t it will not sort the first row.

Usually before sorting, I click on the top left spot in the spreadsheet. Beside the column.

This will move everything in sort.

Thank you, all!

I was not including everything in the selection before sorting (I thought I was). When I did so, the sort worked as expected.

The other thing is to make sure you’re only sorting the column you want to sort. I had somebody once who was doing essentially the same sort you are doing, but he set it to sort by last name, then by first name. Sure, the Henreichs and Ludovics were fine, but he really messed up his Smiths and Joneses.

For extra fanciness, select all the columns with data in them, and go to Data->Filter->AutoFilter. Now you can sort by whatever you want without having to go and select all the columns every time you want to move things around.