# Sorting data in rows by number order

#### fluffynicesheep

##### New Member
I currently have a list of soft skills in cells P2, P3,P4 down to P14 and next to these in cells Q2, Q3, Q4 etc are rankings out of 10.

e.g. cell P2 contains the text "highly motivated" and Q2 contains the number 8 (for 8 out of 10)

I have just manged to sort the numbers in column Q into order by entering the formula below in cell S2 and dragging it down.

=LARGE(\$Q\$2:\$Q\$14,ROW()-ROW(\$1:\$1))

However, what I now need to do in column R is to get the soft skills themselves re-appearing in the new order.....

I'm unsure of the formula to do this at the moment.

Any help would be greatly appreciated!

### Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

#### JimM

##### Well-known Member
Try

=INDEX(\$P\$2:\$P\$14,MATCH(S2,\$Q\$2:\$Q\$14,0))

#### fluffynicesheep

##### New Member
Hi JimM

Unfortunately if I have 4 things that are all rated as 6 for example, it is just showing the first (6 rated) soft skill 4 times, rather than the 4 separate skills.

I kind of need it to say - ok I've listed that 6 rated skill now, I now need it to list the next one that scored 6, etc

Hope that helps

#### Fluff

##### MrExcel MVP, Moderator
=INDEX(\$P\$2:\$P\$14,AGGREGATE(15,6,(ROW(\$P\$2:\$P\$14)-ROW(\$P\$2)+1)/(\$Q\$2:\$Q\$14=LARGE(\$Q\$2:\$Q\$14,ROWS(S\$2:S2))),COUNTIF(R\$2:R2,R2)))

#### fluffynicesheep

##### New Member
Hi Fluff,

Unfortunately when I paste that formula in, it;s stating there is a circular reference.

#### Fluff

##### MrExcel MVP, Moderator
Oops, had the columns the wrong way round, try
=INDEX(\$P\$2:\$P\$14,AGGREGATE(15,6,(ROW(\$P\$2:\$P\$14)-ROW(\$P\$2)+1)/(\$Q\$2:\$Q\$14=LARGE(\$Q\$2:\$Q\$14,ROWS(R\$2:R2))),COUNTIF(S\$2:S2,S2)))

#### fluffynicesheep

##### New Member
Cheers Fluff

Just left the office now, but will try it asap tomorrow!

Ok, that's fine.

#### fluffynicesheep

##### New Member
Hi Fluff,

That works brilliantly ... thanks for you help!

#### Fluff

##### MrExcel MVP, Moderator
Glad to help & thanks for the feedback