Google-sheets – In Google Sheets’ filter views, can I filter columns non-cumulatively

databasegoogle sheets

I have been putting together a spreadsheet in Google Sheets that includes various data/information relating to the hundreds of characters in a novel I am reading. Two of the columns relate to the chapters that a given character, respectively, 1) actually appears in, and 2) is just mentioned in. (The data within this column, while technically numerical, is formatted as plain text.) As a way of allowing a user more easily to find the row for a specific character that they come across while reading, I have been attempting to utilize the new Google Sheets feature of filter views to show only rows/characters who appear or are mentioned within different ranges of chapters ("acts").

The other day, I discovered that filter views (and filters in general) are cumulative, so if I specify certain sets of chapters to display within the "Appearances" column, when I go to specify the sets to display within the "Mentions" column, I can only select those in rows whose "Appearances" values were specified.

I want a filter view to display rows for characters who appeared OR were mentioned in a given range of chapters. But filter views operate under "AND" logic. Is there a way to get filter views to display all of the rows I want them to, given my parameters? Or is there an alternate method of accomplishing this, perhaps using formulae?

(I did scour Google's documentation for possible alternatives—the REGEXMATCH formula seemed particularly useful for my purpose, though I am not sure how I would implement it.)

Best Answer

Instead of filter views, I would use the filter command. For example, suppose Sheet1 holds raw data, with A being a character, B the list of "mentioned" chapters, and C the list of "appeared" chapters. You can then add another sheet for "filtered" data, where the user enters chapter number in, e.g., cell A1 and immediately get the list of rows matching that number thanks to the command

=filter(Sheet1!A2:C, regexmatch(Sheet1!B2:B,"\b"&A1&"\b") + regexmatch(Sheet1!C2:C,"\b"&A1&"\b"))

Here, each regexmatch scans its column (B or C) paying attention to word boundaries (\b) so that, e.g., "20,23,25" would not match "3". Addition plays the role of OR operator here.

If you are sharing this, you can allow editing but protect all cells except A1 on the second sheet: this way, the users can only change the chapter number for filtering.


There is a potential drawback: the changes to A1 are actual edits; i.e., what one user does affects everyone. If this is unacceptable, then filter views are the only option. You can circumvent the "OR" issue by creating a new column with

=B2&","C2

i.e., concatenation of columns B and C. Then apply filter views based on that column. However, the filter view will require either

  • custom formula with regexmatch as above (not user-friendly at all)
  • different format of data to make the condition "text contains..." work: for example, you could format as ,2,4,10,13,16, so that the text to search for would be ,4, (Otherwise, there's the same issue of "13" matching "3".)