ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Sort (https://www.excelbanter.com/excel-discussion-misc-queries/194033-sort.html)

Starbright

Sort
 
I had a spreadsheet emailed to be. I would like to sort it, but there are
several rows that need to be sorted together as one row. For example in A1 I
have John Smith and in B1, B2, B3 I have dates. In A4 I have Jill Brown and
B4, B5,and B6 I have more dates. I need rows 1-3 to sort together and rows
4-6 to sort together. Right now when I sort the rows 1 and 4 sort and excel
puts row 2,3, 5, and 6 at the bottom. Can you help?

Dave Peterson

Sort
 
Excel doesn't like this kind of layout.

But you have a couple of options.

Insert a couple of new columns (say A and B) and use column A to contain the
unique identifier on each row of the group. Then in column B, you can use an
indicator (1, 2, 3, ...) that will be used as the secondary key. (So your data
can stay in order per group.)

The other option (that I can think of) is to "flatten" your data--only if you
have enough columns. Put row 2 of each group in the cells to the right of the
first row. Then row 3 moves to the right of that 2nd row's data.

Then sort your data (one record per entry).

You could even dump the sorted data into the same kind of 3 row format that you
started with.

Starbright wrote:

I had a spreadsheet emailed to be. I would like to sort it, but there are
several rows that need to be sorted together as one row. For example in A1 I
have John Smith and in B1, B2, B3 I have dates. In A4 I have Jill Brown and
B4, B5,and B6 I have more dates. I need rows 1-3 to sort together and rows
4-6 to sort together. Right now when I sort the rows 1 and 4 sort and excel
puts row 2,3, 5, and 6 at the bottom. Can you help?


--

Dave Peterson

Gord Dibben

Sort
 
Assuming A2 and A3 are blank, you could add the name to those cells.

Select column A and F5SpecialBlanksOK

Type an = sign in active blank cell the point or arrow up to the cell above.

Hit CTRL + ENTER to add the names to blank cells.

Copy Column A and in place EditPaste SpecialValuesOKEsc


Gord Dibben MS Excel MVP

On Tue, 8 Jul 2008 05:44:02 -0700, Starbright
wrote:

I had a spreadsheet emailed to be. I would like to sort it, but there are
several rows that need to be sorted together as one row. For example in A1 I
have John Smith and in B1, B2, B3 I have dates. In A4 I have Jill Brown and
B4, B5,and B6 I have more dates. I need rows 1-3 to sort together and rows
4-6 to sort together. Right now when I sort the rows 1 and 4 sort and excel
puts row 2,3, 5, and 6 at the bottom. Can you help?




All times are GMT +1. The time now is 08:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com