Question Locked

Need help with an excel macro to group values

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I am looking to group cells in excel. I have a column called level
and the levels range from 4-6.

4
5
5
5
6
6
5
6
6
4
5
5
5
6
6
5

Group at level 4 (so select all rows with a 5 or 6 until you reach the
next level 4)
Then group at level 5 (so select all rows with a 6 and group them with
the 5 above them)

I don't know any coding so if you could please assist me with this.

Thanks

2 replies

by thumbsup2

You didn't say if you wanted the 4's above the 5's and 6's. No matter which way you want it "grouped", use the Data/Sort.

Of course, you have to select all rows/colums with data in them before you sort. If you fail to select everything, you'll sort just the columns that are selected and leave data hanging out to the right which is now all messed up. This can be a good thing though. If you want to sort the 4's to the bottom, use the decending sort. Then, to get the 5's above the 6's, just select those rows/columns and sort them ascending. It takes two sorts, but then you're done.

This discussion is closed to new replies.