Conditional formatting

little dove

New Member
Joined
Nov 5, 2022
Messages
7
Office Version
  1. 2021
Platform
  1. MacOS
I have a spreadsheet with 100 columns and 50 rows.
I want to highlight the cells with the 8 smallest numbers in each column.

I have tried conditional formatting but it will sometimes highlights a lot more than 8 cells in each column when one of the 8 lowest is repeated.

If there is a duplicate I would like it to highlight the one in the first row it comes to (from row one working down) and then ignore duplicates.

Any help much appreciated, thanks
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Welcome to the MrExcel forum!

If your numbers are integers, it's not too hard:

Book1
ABC
1Header 1Header 2Header 3
2822912
3971457
4502549
5416199
6585427
718495
8676165
9783321
10386770
11375787
1293239
1389347
14678436
15866640
16195584
1746677
18559138
1994748
20108515
21757724
22399552
231322
24654553
25659628
26511242
275688100
28561463
29645757
30858716
31263935
32211380
33525210
34914525
35357016
36539660
37117715
38962276
3982128
4087315
41565688
42827294
43779194
44113595
45495551
46726812
4775410
4812964
4914405
50689045
5132121
52
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:C51Expression=A2+ROW(A2)/100<=SMALL(A$2:A$51+ROW(A$2:A$51)/100,8)textNO


If they're not integers, it gets harder since we need to include some COUNTIF terms. Let me know how this works.
 
Upvote 0
thanks, but cant see how that works. You have highlighted two cells with the same number in column A. Also unfortunately the numbers are to 1 decimal place.
In my example I did the formatting manually. As you can see I am highlighting 8 cells in each column. In the right hand colum I only highlight the 10.8 nearest the top. Other 10.8’s are ignored. The cell with the red border is my next enhancement. I also want to identify if possible the highest of the selected 8.
 

Attachments

  • Screenshot 2022-11-05 at 14.16.04.png.png
    Screenshot 2022-11-05 at 14.16.04.png.png
    55.6 KB · Views: 4
Upvote 0
@little dove I believe that Excel 2021 supports the UNIQUE function.
If so then maybe like below.

Book2
ABC
1111111
22136
3336
4446.5
5556
6665.3
7777
8772
9777
10-2-2-2
11888
12999
13101010
14111111
15121212
16131313
17111
18111
19111
20111
21111
22111
23111
24111
25111
26111
27112
28111
29111
30111
31111
32111
33111
34111
35111
36111
37111
38111
39111
40111
41111
42111
43111
44111
45111
46111
47111
48111
49111
50111
Sheet2
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A1:Y50Expression=AND(A1<>"",A1<=SMALL(UNIQUE(A$1:A$50,,),8),ROWS(A$1:A1),COUNTIF(A$1:A1,A1)=1)textNO


Hope that helps.
 
Upvote 0
I am such an idiot. misunderstood my brief. duplicates are ok, but only as long as no more than 8 cells are highlighted. sorry. How do I do this please?
 
Upvote 0
My original post allowed duplicates, but only highlighted 8 cells maximum. I misunderstood your original question, but it sounds like that's what you want after all. That formula might work for you if you change the 100's to 10000's, but that depends on whether your values are exactly 1 decimal place, or if there are more that aren't showing. Here's another method that should work no matter how many decimals there are:

Book1
ABC
1Header 1Header 2Header 3
210.1117.2
314.312.57.8
418.56.711.3
510.16.114.8
69.289
79.318.916.3
86.55.210.5
915.110.212.7
1019.114.17.9
1117.57.29.4
128.718.215
1311.514.214.8
1419.66.319.5
155.716.113.6
1612.77.418
17811.65
18610.515.6
1916.113.713
20206.45.7
2112.65.814.1
228.719.67.5
236.55.116.4
24611.39.6
257.67.311.1
2616.713.612.5
2711.11014.6
2814.25.813.9
2918.718.76.3
3012.613.314.5
319.75.315.9
3218.614.516.5
331717.216
348.16.113.6
358.918.417.9
361813.45.8
378.214.66.8
38618.813.8
3919.115.76.8
4013.316.411.8
4118.915.117
4215.413.45.8
437.914.112.7
4411.516.89.4
4514.96.313.2
4618.9519.1
47815.29.7
4869.910.6
4915.41313.8
501319.617.6
51108.615.6
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:C51Expression=MATCH(ROW(A2),SORTBY(ROW(A$2:A$51),A$2:A$51),0)=8textNO
A2:C51Expression=MATCH(ROW(A2),SORTBY(ROW(A$2:A$51),A$2:A$51),0)<=8textNO


Conditional Formatting doesn't allow the really heavy outlining, so the red outline doesn't show up really well. Maybe you just highlight the cell in red.
 
Upvote 0
Thanks again. I tried but it didn't work for me.
WHS Golf handicap.xlsx
V
17
Scores
Cells with Conditional Formatting
CellConditionCell FormatStop If True
Q6:AJ50Expression=MATCH(ROW(Q6),SORTBY(ROW(Q$6:Q50),Q$6:Q$50),0)=8textNO
Q6:AJ50Expression=MATCH(ROW(Q6),SORTBY(ROW(Q$6:Q50),Q$6:Q$50),0)<=8textNO
 
Upvote 0
"Conditional Formatting doesn't allow the really heavy outlining, so the red outline doesn't show up really well. Maybe you just highlight the cell in red."
So I just need to change the format on the highest of the highlighted 8 numbers to a different colour. How do I do this please?
 
Upvote 0
Please ignore my last. I have realised what the formulas do. My final word. thanks so much!!!!!!!
 
Upvote 0

Forum statistics

Threads
1,214,912
Messages
6,122,204
Members
449,072
Latest member
DW Draft

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