excel within row sorting problem

G

Guest

I have the following data in a worksheet
i have 800 rows of differing values.

For any 1 row:
Important note: it is in pairs, that is columns A,B is pair 1, C,D is pair
2, E,F is pair 3.

i want to sort it WITHIN ROW on columns b,d,f, with the smallest value in
b,d or f first then the next largest then the largest.

For example
A B C D E F
5 12 2 3 1 6

would become
A B C D E F
2 3 1 6 5 12

b=3
d=6
f=12
this is what i want, the pairs sorted in ascending order for b,d,f for a
given row.
is this possible?

this answer is for 1 row:

A2: =B1
B2: =B1

then copy across as many columns as you need

then sort rows 1 and 2 with row 2 as the sort by row


But I need to do this for 800 rows...

any help very much appreciated

thanks
 
D

Dave Peterson

First, I don't understand everything after:
this answer is for 1 row:

But this might do the first half--but with a catch.

Do you have any ties in any rows in columns B,D,F (with different values in
A,C,E for that tie?

5 12 2 6 1 6

would cause trouble since 6 occurs both in D and F, but columns C and E are not
the same.

If there are no ties--or if there are ties, but both sets of values are the
same, then I could do this:

Using 6 helper columns (I used G:L).

(I had headers in row 1, so my formulas started in row 2.)

In H2: =LARGE((B2,D2,F2),3)
In J2: =LARGE((B2,D2,F2),2)
In L2: =LARGE((B2,D2,F2),1)

In G2, I2, K2 (all the same formula):
=INDEX($A2:$F2,MATCH(H2,$A2:$F2,0)-1)

And drag down the range.

============
If this doesn't work for you, you may want to give more of a snipped of data
(for testing) and rephrase what you meant by the second half of your question.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top