Conditional formatting - highlight text cells based on values other column

smide

Board Regular
Joined
Dec 20, 2015
Messages
164
Office Version
  1. 2016
Platform
  1. Windows
Hello.


In columns A, B and C (A2:C600) I have a lists of different towns (column A), customer names (column B) and buying price for each customer in column C.


In columns D and E I'm receiving new list (towns and customers).


I'm monitoring top 3 customers from each town (top 3 buying prices) and I would like to mark cells for those top 3 cutomer names (column B) IF those names do not appear on new list (columns D and E).


*note: same name could appear in two different towns

example.


[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Town1[/TD]
[TD]Name1[/TD]
[TD]9[/TD]
[TD]Town1[/TD]
[TD]Name1[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Town1[/TD]
[TD]Name2[/TD]
[TD]5[/TD]
[TD]Town1[/TD]
[TD]Name2[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Town1[/TD]
[TD]Name3[/TD]
[TD]12[/TD]
[TD]Town1[/TD]
[TD]Name4[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]Town1[/TD]
[TD]Name4[/TD]
[TD]25[/TD]
[TD]Town1[/TD]
[TD]Name5[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]Town1[/TD]
[TD]Name5[/TD]
[TD]0[/TD]
[TD]Town2[/TD]
[TD]Name15[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]Town2[/TD]
[TD]Name6[/TD]
[TD]11[/TD]
[TD]Town2[/TD]
[TD]Name8[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]Town2[/TD]
[TD]Name7[/TD]
[TD]4[/TD]
[TD]Town2[/TD]
[TD]Name6[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]Town2[/TD]
[TD]Name8[/TD]
[TD]2[/TD]
[TD]Town3[/TD]
[TD]....[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]Town2[/TD]
[TD]Name9[/TD]
[TD]19[/TD]
[TD]....[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]11[/TD]
[TD]Town2[/TD]
[TD]Name10[/TD]
[TD]7[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]Town2[/TD]
[TD]Name11[/TD]
[TD]28[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]13[/TD]
[TD]Town3[/TD]
[TD]...[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]14[/TD]
[TD]....[/TD]
[TD]....[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


explanation:

- top 3 customers from Town1 are Name4 (25), Name3 (12) and Name1 (9), in new list (columns D and E) customer from top 3 Name3 does not appear so highlight cell containing Name3 in column B (bold text)
- top 3 customers from Town2 are Name11 (28), Name9 (19) and Name6 (11), in new list (columns D and E) customers from top 3 Name11 and Name9 both does not appear so higlight both cells in column B (bold text)
 
Last edited:

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
smide, try this....

Edit the following formula and change my 200 row max of ranges to be your expected maximum rows.
Select your desired range in column B and Conditional Formatting > New Rule > Use Formula

Paste in your revised formula and set the bold font format.

Rich (BB code):
  =AND(SUMPRODUCT(($D$2:$D$200&$E$2:$E$200=IF(C2>LARGE((A$2:A$200=A2)*C$2:C$200,4),A2&B2,""))*1) =0,IF(C2>LARGE((A$2:A$200=A2)*C$2:C$200,4),A2&B2,"")>"").

Hope that helps.
 
Upvote 0
Here is an alternative CF formula after selecting B2:Bxx.

Excel Workbook
ABCDE
1
2Town1Name19Town1Name1
3Town1Name25Town1Name2
4Town1Name312Town1Name4
5Town1Name425Town1Name5
6Town1Name50Town2Name15
7Town2Name611Town2Name8
8Town2Name74Town2Name6
9Town2Name82Town3
10Town2Name919
11Town2Name107
12Town2Name1128
13
CF
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B21. / Formula is =AND(B2<>"",C2>=AGGREGATE(14,6,C$2:C$600/(A$2:A$600=A2),3),COUNTIFS(D$2:D$600,A2,E$2:E$600,B2)=0)Abc
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,231
Messages
6,170,885
Members
452,364
Latest member
springate

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