# Is it possible to do a more concise IF x = 1 OR x = 2 OR x = 3 in Google Sheets?

The following is a part of a formula I'm using to filter for week day rows (for conditional formatting):

``````    OR(
MOD(ROW(),7)=2,
MOD(ROW(),7)=3,
MOD(ROW(),7)=4,
MOD(ROW(),7)=5,
MOD(ROW(),7)=6
),
``````

What I really want to be able to say is something like the below pseudo-code:

``````    OR(
MOD(ROW(),7) IN (2,3,4,5,6)
),
``````

Is there a way of doing that? I prefer the non-repating, more concise, and (I think) more performant nature of the proposed version.

Performance isn't something I expected to have to think about but this is a snippet of a pretty long formula I'm running on every cell in a spreadsheet and it gets quite slow.

• What about `MOD(ROW(),7)>1`? May 17, 2023 at 12:14
• That is perfect. Why didn't I think of that?! Doesn't quite answer my general question, but perfectly suits my real-world use case. Thank you! Can you write that as an answer so I can accept?
– Matt
May 17, 2023 at 13:05

Since the result of `MOD(ROW(),7)` can have 2 inappropriate values (0 and 1) and 5 suitable values (2..6), it makes sense to check the condition for a shorter sequence:
`MOD(ROW(),7)>1`
In this case, there is no need to connect multiple conditions using `OR()`
``````=COUNTIF({2,3,4,5,6},MOD(ROW(),7))>0