Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default help: sorting rows by lesser value of two columns

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default help: sorting rows by lesser value of two columns

sorry that wrapped funny. Perhaps this will be clearer:
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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
sorting and getting calculations in other columns use new rows reades Excel Discussion (Misc queries) 1 October 13th 05 01:31 PM
sorting out columns but only for some rows Sam Excel Discussion (Misc queries) 5 April 23rd 05 03:20 PM
How to keep rows together when sorting columns? Amit Excel Worksheet Functions 1 March 28th 05 06:01 PM
Sorting rows AND columns 3D Excel Worksheet Functions 2 January 7th 05 02:15 AM
Sorting rows and columns using VBA vedrah[_3_] Excel Programming 2 April 8th 04 04:44 AM


All times are GMT +1. The time now is 10:31 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"