# How to arrange data in one column based on data in other column in Excel

### Question

• Hello all,

I have an excel sheet and the data present in the excel sheet is shown below:

But i want that column C should be arranged based on column A, and then the output will be shown as :

Please suggest an appropriate solution to this problem

Thursday, July 25, 2013 2:10 PM

• In D1, enter the formula

=MATCH(C1,A:A,False)

and copy down to match column C. Then sort C and D based on column D ascending, then delete column D.

Or copy A and paste it over C.  Unless, of course, there is more going on than you are showing.

Thursday, July 25, 2013 3:14 PM

### All replies

• In D1, enter the formula

=MATCH(C1,A:A,False)

and copy down to match column C. Then sort C and D based on column D ascending, then delete column D.

Or copy A and paste it over C.  Unless, of course, there is more going on than you are showing.

Thursday, July 25, 2013 3:14 PM
• Hi,

here the vba code.

Sub a()
Columns("A:A").Select
Selection.Copy
Columns("C:C").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub

bye

Thursday, July 25, 2013 3:56 PM
• Hi Pankaj,

The solution below is based on the assumption that the two columns have exact same records just with different orders. Hope it helps.

Lily

In column B, number column A from 1 to ?.

Sort Column A and column B on column A by ascending.

In column D Use vlookup function to find the corresponding number in column B of matched value in column A to column C.

Sort column C and column D on column D by ascending.

Delete column B and D.

• Edited by Thursday, July 25, 2013 4:02 PM number column A from 1 to ?
Thursday, July 25, 2013 4:00 PM