I want to highlight a `cell[x,y]`

if

`cell[x,y+1]`

is equal to`cell[x,y]`

and`cell[x-1,y]`

is not equal to`cell[x-1,y+1]`

Is there any easy work sheet function to do this or do I have to write a python script?

One solution would be a conditional formatting.

The AND Function works with conditions and returns only TRUE or FALSE, which is what you use in conditional formatting.

Go to Conditional Formating => Create a new Rule => Use a formula to determine which cells to format.

**More Generally on the AND and conditional formatting**

If I put as a new rule for the whole worksheet:

```
=AND(A1="";B1=6)
```

I obtain the following color every time my two conditions are filled

In your example, you can put the code:

```
=AND(C3=D3;C2<>D2)
```

And put it in the cell Formatting Rule for the cell C3. Then by applying this rule to your whole worksheet you should get

```
=AND(A1=B1;A1048576<>B1048576)
```

With this your whole worksheet should format the cell according to your two rules

Not the answer you're looking for? Browse other questions tagged

.