View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Bill Kuunders Bill Kuunders is offline
external usenet poster
 
Posts: 303
Default Conditional formatting with Rank

No answers yet,,,, so I assume that it is rather difficult or impossible
with conditional formatting.

The other way to do it is with a macro.

This macro will insert a column next to the data column, and fill the new
temporary column (B) with a range
from 1 to 1000.
then it will sort the original data (here in column A)
highlight the top five cells
re-sort the data by the new column B to get the A column back
into the normal unsorted order and
then it will delete the temporary column B.

If you have problems with the use of the macro send me an email direct.

Sub Macro3()

Range("B1").Select
Selection.EntireColumn.Insert
Range("B1").Select
ActiveCell.FormulaR1C1 = "1"
Range("B1").Select
Selection.AutoFill Destination:=Range("B1:B1000"), Type:=xlFillSeries
Range("B1:B1000").Select
Range("A1:B1000").Select
Selection.Sort Key1:=Range("A1"), Order1:=xlDescending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("A1:A5").Select
With Selection.Interior
.ColorIndex = 36
.Pattern = xlSolid
End With
Range("A1:B1000").Select
Selection.Sort Key1:=Range("B1"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("B1").Select
Selection.EntireColumn.Delete
Range("A1").Select
End Sub
--
Greetings from New Zealand

"Sarah" wrote in message
...
Hi there,

I have a column of data that changes regularly. I want to set up
conditional
formatting whereby the top 5 datapoints show up in a different color to
the
others. I think I have to use Rank for this but am not sure how?
Thanks!