Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
share|improve this question

migrated from stackoverflow.com Jun 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

2 Answers 2

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).

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.