#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default sorting

I have a spreadsheet that has three lines of data per one subject. I need to
sort in alphabetical order the first line making sure the 2nd and 3rd stay
with the first line, same for lines 4-6, 7-9, ect...
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 73
Default sorting

In an empty column, in your 1st row of data (excluding the row with column
headings, if any), begins in row 5, enter the formula:

=ROUNDUP((ROW()-(5-1))/3,0)

and copy it down.

If the data begins in row 8, substitute an 8 in place of the 5 in the above
formula.

Convert this column of formulas to values via a column
Copy and Paste Special as 'values'.

Now you can sort using the new column as the primary key and the column that
is to be in alpabetical order as the secondary key.

Good Luck.
In an empty column

"Hitch1961" wrote:

I have a spreadsheet that has three lines of data per one subject. I need to
sort in alphabetical order the first line making sure the 2nd and 3rd stay
with the first line, same for lines 4-6, 7-9, ect...

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 73
Default sorting

I misunderstood what you were looking for in my first response.
Let me try again.

First, insert four (4) columns to the left of your data.
For purposes of this example, these new columns will be columns A, B, C and D.
This example will also assume your first row of data (excluding Column
Headers, if any) is row 5.

In cell A5 enter the formula:
=ROUNDUP((ROW()-(5-1))/3,0)

(Note: If the first row was row 8, substitue an 8 instead of the 5 in the
above formula. Remaining formulas need to be adjusted as appropriate also.)

In cell B5 enter the formula:
=IF(EXACT(A4,A5),B4+0.1,A5+0.1)

In cell C5 enter the formula:
=RIGHT(B5,1)

In cell D5 enter the formula:
=IF(EXACT(C4,C5),D4+1,1)

Convert the formulas in columns A, B and C to values via a Copy and Paste
Special 'values'.
NOTE: do NOT convert column D to values at this time.

Sort all of the data, including the new columns A thru D, using column C as
the Primary Key and column B as the Secondary Key.

Now resort the data using ONLY rows with a 1 in column C, using your
alphabetical column (whatever that might be) as the Primary Key..
(This assumes the alphabetical order is determined by a column with a 1 in
column C.)

In column D, starting with the first row that has a 2 in column C, enter the
formula:
=VLOOKUP(A19,$A$5:$col$row,4,FALSE)
In the above formula, substitute the Last column of data for "col" and the
last row with a 1 in column C for "row".
For example, if your last column of Data is column H and the last row with a
1 in column c is 80, then the formula would be:
=VLOOKUP(A19,$A$5:$H$80,4,FALSE)

Copy this formula down (not up) to the last row of data.

Convert all of the formulas in column D to values.

Finally sort all of the data, including columns A thru D, using column D as
the Primary Key and column B as the Secondary Key.

Your data should be in the desired order.

Good Luck.

"Hitch1961" wrote:

I have a spreadsheet that has three lines of data per one subject. I need to
sort in alphabetical order the first line making sure the 2nd and 3rd stay
with the first line, same for lines 4-6, 7-9, ect...

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 Roy Gudgeon[_2_] Excel Discussion (Misc queries) 3 July 30th 08 04:32 PM
Sorting VLookup vs Sorting SumProduct Lauren Excel Discussion (Misc queries) 1 August 21st 07 12:19 AM
Sorting OfficeNDN Excel Discussion (Misc queries) 1 September 8th 06 03:56 PM
Sorting: Sorting by the First Character dzuy Excel Discussion (Misc queries) 2 June 22nd 06 08:27 PM
sorting Patrick Excel Discussion (Misc queries) 1 July 20th 05 02:15 PM


All times are GMT +1. The time now is 04:56 PM.

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

About Us

"It's about Microsoft Excel"