# In Excel, How to sort a column and keep respective values in other columns

How do I sort a column according to ascending values in excel, while keeping the respective initial value in the other columns on the same row?

Column A shows the name of a subject. Column B shows a numerical value. I want to sort column B according to ascending value and keep the name of the subject attached. The name of the subject should stay linked to the value that was initially in the same row.

``````A 4
B 1
C 3
D 2
``````

should become

``````B 1
D 2
C 3
A 4
``````
-

## migrated from stackoverflow.comJun 8 '13 at 16:06

This question came from our site for professional and enthusiast programmers.

this is basic excel feature- click B1 and run sorting ascending... – Kaz Jaw Jun 8 '13 at 12:47

Highlight the column header (first row). In Excel 2007/2010, go to Data and click Filter. This applies a filter to each column that can be used to sort. Click the downward arrow in the column by which you want to sort and and sort as appropriate (in your example, you would click Smallest to Largest).

-

You can sort a column (for sample, column A with the initial data) and keep the respective values in other columns using the `SMALL` function in Excel. See solution below:

Column A

``````A1 Numbers (Title)
A2  4
A3  1
A4  3
A5  2
``````

Column B

``````B1 Sorted Numbers (Title)

B2 =SMALL(\$A\$2:\$A\$5,ROW(C1))

B3 =SMALL(\$A\$2:\$A\$5,ROW(C2))

B4 =SMALL(\$A\$2:\$A\$5,ROW(C3))

B5 =SMALL(\$A\$2:\$A\$5,ROW(C4))
``````

Excell SMALL Function: Small(array,k). The SMALL function returns the smallest values from a set of values. In our case, the set of values is from `A2` to `A5` - which is our array, and the k is the position from the smallest to return.

`Enter =SMALL((\$A\$2:\$A\$5,ROW(C1))` in `B2` and drag down to `B5`.

-

I have just been through this myself.

What you will need to do is to highlight all the values, then go to Home tab, then Format as Table. Once you have done that, you can just sort things out by clicking on the header.

-
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient reputation you will be able to comment on any post. – Ramhound Oct 2 '15 at 12:02