Conditional format the top x non zero values by column

John_Whin

Board Regular
Joined
Feb 26, 2013
Messages
78
Platform
  1. Windows
I don't know how to use an IF to select non zero values only for conditional formatting.

Ideally want to highlight the top x non zero values in column B only, then highlight top x non zero in column C only etc. Would like to do this across multiple columns.

Thanks
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Excel 2013/2016
KLM
1256
21119
32218
43017
54316
65015
76-114
87-213
98112
109-411
1110-510
1211-69
1312-78
1413-87
1514-96
1615-105
1716-114
18-17-1220
190-1320
200-1420
2120-153
2221-162
2322-171
Sheet1



Formula
=AND(K2 < > 0,(SUMPRODUCT(1-(K$2:K$20=0),--(K$2:K$20 > K2))+1) < =K$1)
Where K1, L1 & M1 are the number of values you want to highlight
 
Last edited:
Upvote 0
Thanks for trying to help, I'll be more specific. Making a hockey penalty spreadsheet and want to highlight the top 3 values in each column. Cells are loaded by function from data input throughout the season on Penalty Input sheet (see bottom image):

Example ... F3 has =COUNTIFS('Penalty Input'!$N:$N,B3,'Penalty Input'!$P:$P,$F$2) so it uses the players name to count the number of each penalty type that player gets as the season progresses.

I can Conditional Format to display the top 3 values in each column. But when the value is 0 as the table loads during the season there are lots of 0's that highlight as a top 3 value in that column.

So
I either need the Conditional Format to ignore the 0's on this sheet
or

I need an IF function that used the COUNTIFS as what is returned if condition is true and nothing (instead of 0) if the condition is false as it gets data from the Penalty Input sheet.

The IF functions I've tried return a 0 instead of a blank cell if the player has not committed that type of penalty.


maybe COUNTIFS isn't the right function choice in the first place.

tried to paste example but didn't work, how do I do that?
 
Last edited by a moderator:
Upvote 0
As you may have noticed you cannot post images to the site.
If you just want the top 3 try
=AND(K2 < > 0,(SUMPRODUCT(1-(K$2:K$20=0),--(K$2:K$20 > K2))+1) < 4)
 
Upvote 0
Here are a view of the sheets

aetr.jpg
 
Upvote 0
If I understand you correctly, the formula I supplied does what you are asking for.
Have you tried it?
 
Upvote 0
If Fluff's solution is not what you need, can you tell us exactly what conditional formatting you have in cell C3 at the moment (assuming it does have CF applied)?
 
Last edited:
Upvote 0
Actually I've got problems on several sheets in the same workbook this morning. On existing sheets even simple functions are not working. I've added a column for example.

in M13 I've got =K13. so I drag that simple formula up and down. (When I manually enter the =cellreference) it works fine. When I add a sheet and do same (even drag formula) it works OK.

But on existing sheets it is malfunctioning.

M11 contains =K11 but returns K13
M12 contains =K12 but returns K13
M13 contains =K13 and returns K13
M14 contains =K14 but returns K13
M15 contains =K15 but returns K13

First I did reopen the spreadsheet, did restart computer and did shut down and then start computer fresh.

108egd5.jpg
[/IMG]
 
Upvote 0
As this is a completely different question to your OP, you'll need to start a new thread.

Also you never responded to either Peter or myself. Did you get your original question resolved?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,599
Messages
6,120,447
Members
448,966
Latest member
DannyC96

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