Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
sorting | Excel Discussion (Misc queries) | |||
Sorting VLookup vs Sorting SumProduct | Excel Discussion (Misc queries) | |||
Sorting | Excel Discussion (Misc queries) | |||
Sorting: Sorting by the First Character | Excel Discussion (Misc queries) | |||
sorting | Excel Discussion (Misc queries) |