Highlighting cells based on contents

andrewb90

Well-known Member
Joined
Dec 16, 2009
Messages
1,077
I am looking for a formula to use in the conditional formatting to change a few cells background color based on the contents of a single cell. I am hoping to take data from say cells D2,4,6,810,12...etc and find the three largest totals and have the row they are in highlight. Anybody have ideas?

Thanks,
Andrew
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Highlight rows 2 to 12, with row 2 bwing the active selection.

Go to FORMAT, CONDITIONAL FORMATTING, FORMULA IS, and type this formula:

=RANK($D2,$D$2:$D$12)<=3

Choose the desired shade.
 
Upvote 0
That works really well, is there a way to have each rank a different color? Or would I have to do separate conditions for that?

Thanks,

Andrew
 
Upvote 0
Yes it is possible

Condition 1
=RANK($D2,$D$2:$D$12)=1

Choose desired shade

Condition 2
=RANK($D2,$D$2:$D$12)=2

Choose desired shade

Condition 3
=RANK($D2,$D$2:$D$12)=3

Choose desired shade
 
Upvote 0
Cool it works just fine! However I would like to have some of the cells highlighted that share the row with the colored cell. So if D2, D6, and D10 were my top three that were colored, I would like A,B, and C in each of those rows to be highlighted as well. Is this doable?

Thanks,

Andrew
 
Upvote 0
Also if I wanted to change my formula to see the lowest 3 scores, what would i change? I might want both the highest and lowest scores to be highlighted.
 
Upvote 0
Hi,

Using RANK may cause issues if you have duplicates, suggest that you use the following:

=$D2>=LARGE($D$2:$D$12,3)

=$D2<=SMALL($D$2:$D$12,3)

To achieve the top 3, adjust the "3" above for more filled values


Excel Workbook
D
21
34
45
567
68
79
80
97
1032
111
123
Sheet1


Hope this helps
Ian.
 
Upvote 0
Hi again,

Just saw your 2nd last post, yes this is doable:)

Before applying the format, highlight the ranges:

A2:A12 and D2:D12 (or whatever your ranges are), make sure that D2 is the active cell in the selection, then apply the CF I showed above.

This will give you:

Excel Workbook
ABCD
1Header 1Header 2Header 3Header 4
21
34
45
567
68
79
80
97
104
111
123
Sheet1



Cheers,
Ian
 
Upvote 0

Forum statistics

Threads
1,224,900
Messages
6,181,631
Members
453,059
Latest member
jkevin

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