Skip to content

Instantly share code, notes, and snippets.

@gmolveau
Created September 14, 2025 19:47
Show Gist options
  • Save gmolveau/54bbbb41f2e392cac0bd9f4f6becdb6e to your computer and use it in GitHub Desktop.
Save gmolveau/54bbbb41f2e392cac0bd9f4f6becdb6e to your computer and use it in GitHub Desktop.
google sheets - dropdown conditions - how to check if certain values are selected for a dropdown cell ?

In Google Sheets, the dropdown cell store its value as a comma-separated list of string.

To check if a dropdown cell has value "A" and "B" selected, use the following formula :

=IF(REGEXMATCH(D2;"[\s]?A[,]?") * REGEXMATCH(D2;"[\s]?B[,]?");"YES";"NOPE")

The regex matches a string, prefixed by an optional space, and suffixed by an optional comma.

Examples :

  • if only A is selected, the cell value is A.
  • if A and B are selected, the cell value is A, B.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment