How sort grouped cells

ABC3132

Board Regular
Joined
Nov 7, 2017
Messages
50
Office Version
  1. 2019
Platform
  1. Windows
Hi
I Have been trying to sort a grouped rows
Sorting Group.xlsx
AB
1NumberLetter
26B
39B
45C
58A
63B
72A
810C
Sheet2

Nonetheless when I do they loose the groups and became mixed up
How I can fix it?
Cheers
 
Last edited:

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
What groups? Can you explain what you mean by groups? And also say in detail what sorting you require.
 
Upvote 0
Hi GlennUK
Sorry it looks like I haven´t been clear.

The spreadsheet is like that and the numbers are grouped by letter
Sorting Group.xlsx
AB
1NumberLetter
28A
32A
46B
59B
63B
75C
810C
Sheet2


When I group them my table looks like that
Sorting Group.xlsx
AB
1NumberLetter
28A
46B
75C
Sheet2


If i sort them now by number keeping the groups "wrapped", it looks like everything goes fine
Sorting Group.xlsx
AB
1NumberLetter
45C
66B
78A
Sheet2


Nonetheless when I have opened the table all the rows are mixed up among the different groups
Sorting Group.xlsx
AB
1NumberLetter
29B
33B
45C
52A
66B
78A
810C
Sheet2


So what I try to do is when I sort groups to keep all the groups´ rows together.
Many thanks!
 
Upvote 0
Your required logic bears no resemblance to any series of actions that can be done in Excel to produce the results you want. I cannot suggest a solution for this.
 
Upvote 0
Your required logic bears no resemblance to any series of actions that can be done in Excel to produce the results you want. I cannot suggest a solution for this.
Thanks anyway...it is what I was afraid of
 
Upvote 0
To get the sorting you want, you must not use grouping - have extra columns for original order (1,2,3, etc etc), and first number per letter (that is easy, logically, as you can just test whether letter is same as row above, and if propagate from cell above, else propagate from number field of same row). Then sort the whole list by first number field, then original order (2 levels in the same sort, not 2 different sorts). How does that sound?
 
Upvote 0
Example of sorted list:
 

Attachments

  • SpecialSort.JPG
    SpecialSort.JPG
    41.8 KB · Views: 93
Upvote 0
Hi,

Another solution with aux Tmp column:
Wb1
ABC
1NumberLetterTmp
28A8
32A8
46B6
59B6
63B6
75C5
810C5
Sheet1
Cell Formulas
RangeFormula
C2:C8C2=INDEX($A$2:$A$8,MATCH(B2,$B$2:$B$8,0))

Sort A:C by Tmp to get this:
Wb1
ABC
1NumberLetterTmp
25C5
310C5
46B6
59B6
63B6
78A8
82A8
Sheet1
 
Last edited:
Upvote 0
Solution
Thanks GlennUK & ZVI. I solved as you suggested me. Now it looks like that:
Sorting Group.xlsx
ABCDEF
1NumberContact?CompanyNamePositionTMB
2100CARoxanneManager100
3110AAlbaR&D100
4200BGlennCEO200
5210CBZviCOO200
6220CBRudyEngineer200
7300CMariaManager300
8310CCElenaAssitant300
Sheet1
Cell Formulas
RangeFormula
F2:F8F2=INDEX($A$2:$A$8,MATCH(C2,$C$2:$C$8,0))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B2:E8Expression=$B2="C"textNO

The key reason why I wanted to keep them all together, it was not only because they are a group but also because in the real table they are different names of the same company. The conditional colouring I have added
. is because I want to easily see in the table who the right contact is.
Thanks both for your time.
Have a nice weekend
 
Upvote 0
Glad we can help, thank you for the feedback.
And special thanks for the CEO&COO positions in your table for Glenn and Zvi ?
 
Upvote 0

Forum statistics

Threads
1,215,375
Messages
6,124,578
Members
449,174
Latest member
chandan4057

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top