Have multiple conditions trigger the same color

2019-08-09 03:27发布

问题:

I'm using Google Sheets, a beginner to this (just started yesterday) and trying to create a condition where:

if text contains "x, y, or z"

then color red

There must be some way to do it because I've been doing separate conditions for each one and it's taking up time to do it.

回答1:

Select the relevant range (I am assuming starts at A1) and clear any existing CF rules from it. Format, Conditional formatting..., Format cells if... Custom formula is and

=regexmatch(A1,"x|y|z")

with red fill and Done.



回答2:

Looks a little bit ugly, but this is the way you can do it:

=OR(INDIRECT( ADDRESS( ROW( ) ; COLUMN( ) ) )= "x";
    INDIRECT( ADDRESS( ROW( ) ; COLUMN( ) ) )= "y";
    INDIRECT( ADDRESS( ROW( ) ; COLUMN( ) ) )= "z")

In my opinion there is no better way to get the current cell as with the long term.