View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Greg Greg is offline
external usenet poster
 
Posts: 331
Default sorting one column, move some duplicates to bottom of sort

Thank You. i used that on my sample and works perfect! i'm applying this to
my actual worksheet but i have some troubles setting this up correctly.

1. The sort area is from B7:J106 (so there is more that just the two Columns
to sort but those two Columns i mentioned determine the sort order. i do not
want column A sorted.
2. How would i code this to sort and filter? below is what i have so far
assigned to a button that sorts the way i want but not sending the lower
value duplicates to the bottom of list.
Sub SortSaturday()
'
' Sort for Saturday
'

'
Range("J7:J106").Select
ActiveWorkbook.Worksheets("Saturday").sort.SortFie lds.Clear
ActiveWorkbook.Worksheets("Saturday").sort.SortFie lds.Add
Key:=Range("J7"), _
SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Saturday").sort
.SetRange Range("B7:J106")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub

Once again,
MANY THANKS IN ADVANCE!

"Bernie Deitrick" wrote:

Greg,

In the next column - for our example, we will use column C, so use cell C2 - use the formula

=SUMPRODUCT(($A$2:$A$8=A2)*($B$2:$B$8B2))

Change the 8 of the $A$8 and $B$8 to be the last row of your data, then copy down.

Finally, sort by column C ascending, then column B descending.

HTH,
Bernie
MS Excel MVP


"Greg" wrote in message
...
I have a button that sorts multiple columns based on one row. in another row
there are duplicate values ( Peoples names). i would like to keep all records
but would like to send the duplicates to the bottom. sorry I'm not sure of
the proper way to ask this. so here is a basic example.

John Doe; 678
Jane Doe; 654
John Doe: 721
Jim Smith; 672
Jim Smith; 673
John Doe; 688
Sam Andrews; 700

I would like the above to sort like this
John Doe; 721
Sam Andrew; 700
Jim Smith; 673
Jane Doe; 654
John Doe; 688
John Doe; 678
Jim Smith; 672


Sort the number column largest to smallest; keep any lower number duplicate
names sorted on the bottom.

Many Thanks in advance
Greg



.