Using conditional formatting or any other method to find the top 3 of a data set and then the next 3 in the remainder plus extra data

Taz5678

New Member
Joined
May 17, 2023
Messages
6
Office Version
  1. 365
Platform
  1. MacOS
I am working on a spreadsheet that needs to identify the top 3 scores in a set number of columns. I have done this using conditional formatting but it is not essential if there is a better way to solve the following problem:

I need to use the remaining scores from the info above plus some additional ones to create the next top 3 but these cannot be the original ones. I need these clearly identified which is why I started with conditional formatting.

Whatever the solution, the formulas etc need to be set up so that changes to the scores can be inputted and therefore the colours change (or however it is identified).

Hope someone can help because I have spent too much time today trying to work this out!
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Hi @Taz5678 Welcome to the MrExcel forum. Please accept my warmest greetings and sincere hope that all is well.

Try the following conditional format

Dante Amor
A
1scores
210
324
425
520
624
731
816
930
1011
1124
1216
Hoja6
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:A12Expression=$A2>=LARGE($A$2:$A$12,3)textNO



--------------
Let me know the result and I'll get back to you as soon as I can.
Cordially
Dante Amor
--------------
 
Upvote 0
I am working on a spreadsheet that needs to identify the top 3 scores in a set number of columns. I have done this using conditional formatting but it is not essential if there is a better way to solve the following problem:

I need to use the remaining scores from the info above plus some additional ones to create the next top 3 but these cannot be the original ones. I need these clearly identified which is why I started with conditional formatting.

Whatever the solution, the formulas etc need to be set up so that changes to the scores can be inputted and therefore the colours change (or however it is identified).

Hope someone can help because I have spent too much time today trying to work this out!
What happens if you have 2 (or more) scores in say the top 3 that are the same? Do you only want to identify that score once, or as many times as it appears?
 
Upvote 0
See if this gives you what you want. Change sheet name & number of columns to suit & test on a copy of your workbook.
VBA Code:
Option Explicit
Sub Three_Then_Three()
    Application.ScreenUpdating = False
    Dim ws As Worksheet, r As Range
    Set ws = Worksheets("Sheet1")       '<~~ *** Change to actual sheet name ***
    Dim LRow As Long, a As Long, b As Long, i As Long
    
    For i = 1 To 5                      '<~~ *** Change the 5 to the number of columns you want ***
        LRow = ws.Cells(Rows.Count, i).End(xlUp).Row
        Set r = ws.Range(ws.Cells(2, i), ws.Cells(LRow, i))
        With r
            a = WorksheetFunction.Large(WorksheetFunction.Unique(r), 3)
            b = WorksheetFunction.Large(WorksheetFunction.Unique(r), 6)
            .FormatConditions.Delete
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlGreaterEqual, Formula1:="=" & a
            .FormatConditions(1).Interior.Color = vbYellow
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlBetween, Formula1:="=" & b, Formula2:="=" & a
            .FormatConditions(2).Interior.Color = vbGreen
        End With
    Next i
    Application.ScreenUpdating = True
End Sub

Before:
Book1
ABCDE
1scores scores scores scores scores
23756118684
34194218981
46459809483
52094721379
63897248021
73645491299
88687213855
96217288259
109680326563
112677234234
129762695229
131632548631
142489714073
158585478241
161826647731
176721307634
183158726048
193992988440
203389441289
218873624941
229418123321
233580388363
247573431365
251849326640
264251977812
274749757013
287958919594
296271449185
3010020301163
317624353539
326049737828
333670683914
347883729079
355076137673
368136399642
378892505451
385377511960
391592286083
403967353639
419921656287
422639764089
438049379675
444814122058
451365687053
463130617456
472440229974
484620209995
496625965413
504360948115
518515273396
Sheet1


After:
Book1
ABCDE
1scores scores scores scores scores
23756118684
34194218981
46459809483
52094721379
63897248021
73645491299
88687213855
96217288259
109680326563
112677234234
129762695229
131632548631
142489714073
158585478241
161826647731
176721307634
183158726048
193992988440
203389441289
218873624941
229418123321
233580388363
247573431365
251849326640
264251977812
274749757013
287958919594
296271449185
3010020301163
317624353539
326049737828
333670683914
347883729079
355076137673
368136399642
378892505451
385377511960
391592286083
403967353639
419921656287
422639764089
438049379675
444814122058
451365687053
463130617456
472440229974
484620209995
496625965413
504360948115
518515273396
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:A51Cell Value>=97textYES
A2:A51Cell Valuebetween 88 and 97textYES
B2:B51Cell Value>=92textYES
B2:B51Cell Valuebetween 85 and 92textYES
C2:C51Cell Value>=96textYES
C2:C51Cell Valuebetween 80 and 96textYES
D2:D51Cell Value>=95textYES
D2:D51Cell Valuebetween 90 and 95textYES
E2:E51Cell Value>=95textYES
E2:E51Cell Valuebetween 87 and 95textYES
 
Upvote 0
Whatever the solution, the formulas etc need to be set up so that changes to the scores can be inputted and therefore the colours change (or however it is identified).
To apply the above code automatically, put the following in the worksheet code area of the sheet in question:
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Application.EnableEvents = False
    Application.ScreenUpdating = False
    Dim r As Range
    Dim LRow As Long, a As Long, b As Long, i As Long
    
    For i = 1 To 5                      '<~~ *** Change the 5 to the number of columns you want ***
        LRow = Cells(Rows.Count, i).End(xlUp).Row
        Set r = Range(Cells(2, i), Cells(LRow, i))
        With r
            a = WorksheetFunction.Large(WorksheetFunction.Unique(r), 3)
            b = WorksheetFunction.Large(WorksheetFunction.Unique(r), 6)
            .FormatConditions.Delete
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlGreaterEqual, Formula1:="=" & a
            .FormatConditions(1).Interior.Color = vbYellow
            .FormatConditions.Add Type:=xlCellValue, Operator:=xlBetween, Formula1:="=" & b, Formula2:="=" & a
            .FormatConditions(2).Interior.Color = vbGreen
        End With
    Next i
    Application.ScreenUpdating = True
    Application.EnableEvents = True
End Sub
 
Upvote 0
Thank you so much for the solutions. I am afraid this is all going over my head - I am not as competent with excel as I need to be. Please can you imagine I am a 3 year old! Also I realise that I said columns in my thread when I meant rows. I think that sums up my level!
 
Upvote 0
What happens if you have 2 (or more) scores in say the top 3 that are the same? Do you only want to identify that score once, or as many times as it appears?
The 3 that are selected first cannot be duplicated. Thanks
 
Upvote 0
OK, before I'm willing to progress this any further, I'll need to see your actual data. You can do this by either posting a copy of your sheet using the XL2BB - Excel Range to BBCode, or alternatively, share your file via Dropbox, Google Drive or similar file sharing service.
 
Upvote 0
OK, before I'm willing to progress this any further, I'll need to see your actual data. You can do this by either posting a copy of your sheet using the XL2BB - Excel Range to BBCode, or alternatively, share your file via Dropbox, Google Drive or similar file sharing service.
Great. Thank you. I shall do that later today as I am off to meetings now. Really grateful!
 
Upvote 0
OK, before I'm willing to progress this any further, I'll need to see your actual data. You can do this by either posting a copy of your sheet using the XL2BB - Excel Range to BBCode, or alternatively, share your file via Dropbox, Google Drive or similar file sharing service.

Hi Kevin9999,

I have uploaded the spreadsheet to my google drive, the link is above. To clarify what I need to do:

I need to workout the top 3 from columns T-AM (1) and then the top 3 from columns P, T-AM,AO-BJ (2). I need these highlighted in two different colours and then a total of (1) in column AN and a total of (2) in BK.

Top 3 of (1) takes priority over top 3 of (2) and there can be no duplicates.

I need this to be set up so that changes can be made to the scores and the colours and totals update.

I hope you are able to help.

Thanks
 
Upvote 0

Forum statistics

Threads
1,215,107
Messages
6,123,126
Members
449,097
Latest member
mlckr

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