If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Sorting - keeping rows together

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-09-04, 12:45
joneill joneill is offline
Registered User
 
Join Date: Aug 2004
Posts: 9
Sorting - keeping rows together

I have a spreadsheet listing a customer name in row #1; then the next 2 rows (rows #2 & #3) below it lists the customer's branches and totals loans completed. The last row (#4) totals all the branch loans made. I need to sort my list of customers by the customer loan total, but keep the rows together that shows the branch totals

Example:
Row #1 : First American Bank
Row #2 : First American Bank North 5 loans
Row #3 : First American Bank East 10 loans
Row #4 : Customer Total = 15 loans

Row #5: Hillsdale Bank
Row #6 : Hillsdale Bank West 7 loans
Row #7 : Hillsdale Bank South 12 loans
Row #8 : Customer Total 19 loans

So now I want to sort descending so that Hillsdale Bank is listed first because they have more loans - but I need to keep rows 5-8 together.

Any help would be appreciated.
Reply With Quote
  #2 (permalink)  
Old 08-12-04, 11:47
JerryDal JerryDal is offline
Registered User
 
Join Date: Jan 2002
Location: Bay Area
Posts: 473
Here is a solution I came up with to sort a list by group totals in Excel by using a specific format for the totals row and a formula inserted in a column to accomplish the task.

In each total row, I added the bank name with the underscore character between each word of the name, and an asterisk at the end, for example, " First_American_Bank Total*". The underscore characters cause the row to sort to the bottom of each group when the bank name column is sorted in ascending order. The asterisk is used by the formula to display the total for each row of the group.

In my attached example, the formula causes every row in column C to show the total number of loans for the specific bank. In cell C2, the formula reads:
=IF(RIGHT(A2,1) = "*",B2,C3)
translated: if this row has an asterisk at the end, it is a total row so display the total found in column B, otherwise display the value in the next cell down in column C.

When you sort by the formula in column C as the primary sort column in descending order , and by "Bank Name" as the secondary sort column in ascending order, you get the largest loan totals at the top, and banks with the same loan totals will be sorted alphabetically in ascending order.

Jerry


The great French sculptor Rodin once explained how to carve a statue of a horse. “Get a block of marble, take a hammer and a chisel, and cut away everything that doesn’t look like a horse.”
Reply With Quote
  #3 (permalink)  
Old 08-12-04, 11:50
JerryDal JerryDal is offline
Registered User
 
Join Date: Jan 2002
Location: Bay Area
Posts: 473
...and here is the attachment.
Attached Files
File Type: zip GroupSortExample.zip (6.0 KB, 205 views)
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On