Greg Smith
Greg Smith

Reputation: 15

How to check multiple cells for value in Google Sheets

I'm checking cells A1:Ax to see if they are True, if yes, I would like one cell to change its value.

Unfortunately, a regular IF statement can't accept a range, like: IF(A1:A4=True, Unlocked, Locked).

How do I do this? I've been wracking my brain for days to find a solution.

Upvotes: 1

Views: 4072

Answers (1)

oszkar
oszkar

Reputation: 992

=IF(COUNTIF(A1:Ax, TRUE) = ROWS(A1:Ax), "Unlocked", "Locked") will do the trick.

It checks if the number of TRUE values in the range equals the number of cells (i.e. all cells contains TRUE). If yes, put string "Unlocked", otherwise "Locked" in the destination cell.

Upvotes: 2

Related Questions