Sorting multiple sub-total groups at once

Mikalas

New Member
Joined
Apr 17, 2020
Messages
4
Office Version
  1. 2010
Platform
  1. Windows
Hello,

I have a spreadsheet that lists companies and their employees and how many calls each makes. Each company is already grouped and subtotaled with the employees and their calls underneath the company header. I have several companies within this sheet. I need to sort the calls by employee within each company from highest to lowest calls. Is there a way to do this for all companies all at once rather than do it by each company and highlight the rows within each company and sort by employee calls? This gets a bit tedious. I was hoping there is a way to do this more efficiently. Thank you!
 

Attachments

  • Sample Spreadsheet.JPG
    Sample Spreadsheet.JPG
    29.9 KB · Views: 11

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Hi and welcome to MrExcel!

Try this:

VBA Code:
Sub Sorting_groups()
  Dim a As Range
  For Each a In Range("A2:A" & Range("C" & Rows.Count).End(3).Row).SpecialCells(xlCellTypeBlanks).Areas
    a.Offset(, 1).Resize(, 2).Sort a.Offset(, 2).Cells(1), xlDescending, , , , , , xlNo
  Next
End Sub
 
Upvote 0
Thank you for your response! I will try it this weekend. I'm excited that it will work and save me some time!
Michelle
 
Upvote 0
You can use Power Query to Sort Data

Example which i have used: Unformated Data
Book1
BCD
8Company NameTechnicianCalls per Day
9AX10
10AX12
11AX215
12BY13
13BY114
14BY210
15CZ4
16CZ12
17CZ26
Sheet1



Which i have formatted to the following using Power Query

Book1
ABC
1Company NameTechnicianCalls per Day
2CZ26
3CZ4
4CZ12
5BY114
6BY13
7BY210
8AX215
9AX10
10AX12
Sheet2
 
Upvote 0
Thank you for your response! I will try it this weekend. I'm excited that it will work and save me some time!
Michelle
The macro assumes that the first employee is in cell A2 and the other data is in columns B and C.
 
Upvote 0

Forum statistics

Threads
1,215,583
Messages
6,125,665
Members
449,247
Latest member
wingedshoes

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