Conditional formatting relative to neighbouring cell?

enter image description here

Is there a simple way (no VBA) way to achieve a conditional formatting based on a neighbouring cell for two adjacent columns?

In above example the left table shows the intended result. If number is smaller than neighbouring number then green, if larger then red, if same then no formatting.

The right table shows the closest I get using conditional formatting. Sorry for German dialog windows but I guess it's clear what is what.


Solution 1:

Reframe your idea not as "is A smaller than B" but "is A the smaller of the two" or "is A the larger of the two". This insight leads to the following formula, which ought to work (note carefully the placement of the $ signs):

=D1<MAX($D1:$E1) > green

and

=D1>MIN($D1:$E1) > red

When MIN = D1 = MAX then neither is true and you get no colour.