highlight-unique-distinct-values-in-two-ranges-combined

Conditional formatting formula in B2:E5:

=IF(ROW(B2)>MIN(ROW(tbl)), COUNTIF(OFFSET(tbl, 0, 0, MIN(ROW(B2)-MIN(ROW(tbl))), MAX(COLUMN(tbl))), B2)+COUNTIF(OFFSET(tbl, MIN(ROW(B2)-MIN(ROW(tbl))), 0, 1, MIN(COLUMN(B2))), B2), COUNTIF(OFFSET(tbl, 0, 0, 1, MIN(COLUMN(B2))), B2))=1

Conditional formatting formula in B7:E10:

=IF(COUNTIF(tbl, B7)+IF(ROW(B7)>MIN(ROW(tbl1)), COUNTIF(OFFSET(tbl1, 0, 0, MIN(ROW(B7)-MIN(ROW(tbl1))), MAX(COLUMN(tbl1))), B7)+COUNTIF(OFFSET(tbl1, MIN(ROW(B7)-MIN(ROW(tbl1))), 0, 1, MIN(COLUMN(B7))), B7), COUNTIF(OFFSET(tbl1, 0, 0, 1, MIN(COLUMN(B7))), B7))=1, 1, 0)

Named ranges
tbl (B2:E5)
tbl1 (B7:E10)
What is named ranges?

Download excel example file.
highlight-unique-distinct-values-in-two-ranges-combined.xls
(Excel 97-2003 Workbook *.xls)

Functions in this article

IF(logical_test,[value_if:true],[value_if_false])
Checks whether a condition is met, and returns one value if TRUE, and another value if FALSE

ROW(reference)
returns the row number of a reference

COUNTIF(range,criteria)
Counts the number of cells within a range that meet the given condition

INDEX(array,row_num,[column_num])
Returns a value or reference of the cell at the intersection of a particular row and column, in a given range

MAX(number1,[number2],)
Returns the largest value in a set of values. Ignores logical values and text.

MATCH(lookup_value;lookup_array; [match_type]
Returns the relative position of an item in an array that matches a specified value

COLUMN(reference) Returns the column number of a reference

MIN(number1,[number2])
Returns the smallest number in a set of values. Ignores logical values and text