help: sorting rows by lesser value of two columns

  • Thread starter TheObstacleIsThePath
  • Start date
T

TheObstacleIsThePath

I'd like a VB script method of sorting that uses two columns (both
contain dates/times). I want to sort the entire row in ascending
order by the lesser value of the two columns.

Example:

column A Column B

Row 1: 1
2 <--lesser value is 1
Row 2: 2
2 <--Lesser value is 2
Row 3: 4
4 <--Lesser value is 4
Row 4: 5
3 <--Lesser value is 3

BECOMES:

column A Column B

Row 1: 1 2
Row 2: 2 2
Row 3: 5 3
Row 4: 4 4

I could do it using a third column, but would prefer something more
elegant using a temproray array. Any help would be appreciated. My
problem is this: I can create a "sort-order array", but I don't know
how to shuffle the rows according to the sequence of the array.

Thanks in advance,

Todd
 

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