ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How to sort by grouped rows (https://www.excelbanter.com/excel-discussion-misc-queries/20623-how-sort-grouped-rows.html)

Mike

How to sort by grouped rows
 
I have several groupings of rows and I wish to sort these groupings based on
the cell value in one cell in each grouping. How can this be done?

For example... rows 1 & 2 are grouped and rows 3 & 4 are grouped, if I wish
to sort these grouped rows by the cell value in C2 (= 6) in the first group
and cell value C4 (= 7) in the second group without changing the groupings,
how would I do this? The values in column C are equations, i.e., C1 = A1 + B1

A B C
1 2 2 4
2 3 8 11
3 1 2 3
4 3 4 7

Mike

Oops, C2 actually equals 11, not 6.

"Mike" wrote:

I have several groupings of rows and I wish to sort these groupings based on
the cell value in one cell in each grouping. How can this be done?

For example... rows 1 & 2 are grouped and rows 3 & 4 are grouped, if I wish
to sort these grouped rows by the cell value in C2 (= 6) in the first group
and cell value C4 (= 7) in the second group without changing the groupings,
how would I do this? The values in column C are equations, i.e., C1 = A1 + B1

A B C
1 2 2 4
2 3 8 11
3 1 2 3
4 3 4 7


Jay

I have several groupings of rows and I wish to sort these groupings
based on the cell value in one cell in each grouping. How can this be
done?

For example... rows 1 & 2 are grouped and rows 3 & 4 are grouped, if I
wish to sort these grouped rows by the cell value in C2 (= 11) in the
first group and cell value C4 (= 7) in the second group without
changing the groupings, how would I do this? The values in column C
are equations, i.e., C1 = A1 + B1

A B C
1 2 2 4
2 3 8 11
3 1 2 3
4 3 4 7


Oops, C2 actually equals 11, not 6.


One way is to use D and E as helper columns. Put the following in D1 and
copy down:
=IF(MOD(ROW(),2)=0,C1,C2)

Put the following in E1 and copy down:
=ROW()

Then select everything and sort on column D then E.

You can hide the helpers before printing or disseminating the file.


All times are GMT +1. The time now is 06:59 AM.

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