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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Highlighting the 5 Largest Numbers in a list
Hi all,
I have a Score column that runs into many entries. Is there a way to highlight the top 5 scores on the list in different colours. Conditional format permits me to highlight the three largest only (yes another gripe on this much needed excel feature!) Any help is appreciated in advance!! Regards Manosh |
#2
|
|||
|
|||
Highlighting the 5 Largest Numbers in a list
Does this help?
Sub highlightlargest() lr = Cells(Rows.Count, "e").End(xlUp).Row rng = Range("e2:e" & lr) With Columns(5) ..Interior.ColorIndex = 0 ..Find(Application.Large(rng, 1)).Interior.ColorIndex = 4 ..Find(Application.Large(rng, 2)).Interior.ColorIndex = 5 'etc End With End Sub -- Don Guillett SalesAid Software wrote in message oups.com... Hi all, I have a Score column that runs into many entries. Is there a way to highlight the top 5 scores on the list in different colours. Conditional format permits me to highlight the three largest only (yes another gripe on this much needed excel feature!) Any help is appreciated in advance!! Regards Manosh |
#3
|
|||
|
|||
Highlighting the 5 Largest Numbers in a list
Say your data goes from A1 thru A100
Set the conditional format for A1 to be: Formula Is =(A1LARGE(A$1:A$100,6)) with a hi-lighted format and copy the format down the column The top 5 items will be hi-lighted -- Gary's Student " wrote: Hi all, I have a Score column that runs into many entries. Is there a way to highlight the top 5 scores on the list in different colours. Conditional format permits me to highlight the three largest only (yes another gripe on this much needed excel feature!) Any help is appreciated in advance!! Regards Manosh |
#4
|
|||
|
|||
Highlighting the 5 Largest Numbers in a list
|
#5
|
|||
|
|||
Highlighting the 5 Largest Numbers in a list
Thanks for your reply Don
Apologies for the duplicate posting. i understand how the code may be extended for n etc numbers to be highlighted different colours. However, where do i enter this code? is it in the view code area of the worksheet? regards manosh |
#6
|
|||
|
|||
Highlighting the 5 Largest Numbers in a list
Manosh, the code that Don provided need to go in a module not in the sheet
code To put in this macro, from your workbook right-click the workbook's icon and pick View Code. This icon is to the left of the "File" menu this will open the VBA editor, in Project Explorer click on your workbook name, if you don't see it press CTRL + r to open the Project Explorer, then go to insert, module, and paste the code in the window that opens on the right hand side, press Alt and Q to close this window and go back to your workbook and press alt and F8, this will bring up a box to pick the Macro from, click on the Macro name to run it. If you are using excel 2000 or newer you may have to change the macro security settings to get the macro to run. To change the security settings go to tools, macro, security, security level and set it to medium -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 wrote in message ups.com... Thanks for your reply Don Apologies for the duplicate posting. i understand how the code may be extended for n etc numbers to be highlighted different colours. However, where do i enter this code? is it in the view code area of the worksheet? regards manosh |
#7
|
|||
|
|||
Highlighting the 5 Largest Numbers in a list
Thanks Paul
This works great when you run the macro. However, the beauty of the conditional format was that it was 'live' How can this code be run automatically to reflect anychanges to the sheet automatically? Regards M |
#8
|
|||
|
|||
Highlighting the 5 Largest Numbers in a list
Hi Manosh,
This will make it 'live'. I used it in the worksheet module and it works fine. Private Sub Worksheet_Change(ByVal Target As Range) Dim lr As Integer Dim rng As Range lr = Cells(Rows.Count, "e").End(xlUp).Row Set rng = Range("e2:e" & lr) With Columns(5) ..Interior.ColorIndex = 0 ..Find(Application.Large(rng, 1)).Interior.ColorIndex = 4 ..Find(Application.Large(rng, 2)).Interior.ColorIndex = 5 'etc End With End Sub HTH Regards, Howard wrote in message oups.com... Hi all, I have a Score column that runs into many entries. Is there a way to highlight the top 5 scores on the list in different colours. Conditional format permits me to highlight the three largest only (yes another gripe on this much needed excel feature!) Any help is appreciated in advance!! Regards Manosh |
#9
|
|||
|
|||
Highlighting the 5 Largest Numbers in a list
This has an error checker.
Private Sub Worksheet_Change(ByVal Target As Range) Dim lr As Integer Dim rng As Range lr = Cells(Rows.Count, "e").End(xlUp).Row Set rng = Range("e2:e" & lr) On Error GoTo nope With Columns(5) ..Interior.ColorIndex = 0 ..Find(Application.Large(rng, 1)).Interior.ColorIndex = 4 ..Find(Application.Large(rng, 2)).Interior.ColorIndex = 5 'etc End With nope: End Sub wrote in message oups.com... Hi all, I have a Score column that runs into many entries. Is there a way to highlight the top 5 scores on the list in different colours. Conditional format permits me to highlight the three largest only (yes another gripe on this much needed excel feature!) Any help is appreciated in advance!! Regards Manosh |
#10
|
|||
|
|||
Highlighting the 5 Largest Numbers in a list
Once again thanks Howard for the prompt reply on this forum.
On using this i have found that when there are two equal values (or same rank) the formula only highlights the first occurance. Can this be corrected? To easier computing! M |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Conditional format from a list of numbers | langba | General Discussion | 3 | April 7th, 2006 11:02 AM |
find sum in list of of numbers | Jim Thomlinson | New Users | 5 | January 4th, 2006 07:07 PM |
Creating a list of sequential numbers | eb1mom | Database Design | 2 | September 22nd, 2004 10:37 PM |
adding values from another worksheet by matching criteria | Frank Kabel | Worksheet Functions | 2 | March 16th, 2004 03:15 PM |
Create a randomly sorted list from selected numbers | Twofingers | Worksheet Functions | 6 | December 31st, 2003 11:49 PM |