Find all cells in a Google spreadsheet that failed validation - google-sheets

I have a large Google spreadsheet in which I have defined data validation rules. When a cell fails validation, there's a warning displayed (or when using "Reject input", an error message is displayed and it won't even let me enter invalid data, but I don't want to reject input, just show a warning).
Is there a filter or any other way to only show rows that have cells with these warnings in them? Or at least find it somehow so I can keep on "finding next" to go through all invalid cells? Right now, I have to visually scan the entire spreadsheet looking for the little warning icon, and I could be missing a few if I'm scrolling too fast.

I would try using a combination of IFERROR formulas with VLOOKUP then you could set the errors to return a Identifier which you can use with a filter function to pull out all the ERRORS into another table
=IFERROR(VLOOKUP(E3,B$3:C$16,2,False),"N/A")
=FILTER(E3:F16,F3:F16="N/A") v
You can use this spreadsheet for a reference to the idea.
https://docs.google.com/spreadsheets/d/1qczxeJNVlXm_04rK3FE2Sv5PgOapYWv67xOSFxxH5lg/edit?usp=sharing

For the Data range validation this is useful.
"A:A" range contains data validation from "Sheet2!A2:A6"
Global Filter >> Column A >> Custom Formula
=COUNTIF(Sheet2!$A$2:$A$6,A2) < 1
This will filter all data which doesn't match the "Sheet2!A2:A6" range.

Related

How to display #REF! (You need to connect these sheets) when using IFERROR to display Blank Cell

I understand that Google Sheets must be explicitly granted permission to pull data from other spreadsheets using IMPORTRANGE
However, when using IFERROR alongside VLOOKUP to display the value argument has a blank cell - How do you still allow for the #REF! (You need to connect these sheets) to be displayed?
I appreciate that as a workaround I could just display a "." but I'm curious if it's possible to legitimately without a workaround display a blank cell with no valid result but still allow for #REF! (You need to connect these sheets) to be displayed?
=IFERROR(VLOOKUP(Meta!$A$12,IMPORTRANGE(""&$M31&"","Template!$A$1:$H$6"),7, false), "")
yes, they need to be connected and IFERROR will only hide that #REF! error. if you got complex (non-standalone IMPORTRANGE formula) that Allow access button will not appear. you are always obligated to run the IMPORTRANGE fx as standalone to establish the connection (it can be just a single cell - =IMPORTRANGE(""&$M31&"","Template!$A$1")) and only then use your complex (multi-layer) formula.
This would decrease performance, probably by a lot, but I think this (or something similar) would technically work:
=if(1+0*importrange(...),iferror(vlookup(...)))

newRichTextValue() after query

After apply query I want to change some text color via app script, but my query show this error because I changed data, any ways to solve?
To format I used newRichTextValue()
Ty!
As #player0 mentioned when using Query you need to have free cells depending on the range that your formula will use, otherwise this error will appear:
"Array result was not expanded because it would overwrite data in #range#."
Solution can be either delete the conflicting cell with your query or move the query to a blank row so it can retrieve the data from your query.

Data Validation, Complex, based on another sheet

Sample sheet here.
Have 2 sheets; DataTemplate stores the validation keys and DataValidation is the sheet that should include data validation based on said keys.
Eg: DataValidation!B11:E17 is validated against DataTemplate!B11:E17 (please see sample)
Sample validation requirements:
IF coressponding DataTemplate value == -500 then Cell must be blank
IF coressponding DataTemplate value == -200 then Cell must be blank or positive number
IF coressponding DataTemplate value > 0 then Cell must be a number between 0..1 OR a string in [ "A", "B", "C" ]
I've attemped this with formulae like below but other than very simple validation available on the net, I've not been able to make anything work.
=SWITCH(INDIRECT("DataTemplate!D11:E17"),-500,ISBLANK(D11),-200,OR(ISNUMBER(D11),ISBLANK(D11),OR(ISNUMBER(D11),IFERROR(MATCH(D11,SPLIT("A,B,C",","),FALSE),FALSE)>0)
EDIT; solved thanks to Jeremy Kahan (below).
My issue was, I was trying to apply Conditional Formatting rules to Conditional Validation, but apparently they are quite different in terms of their application (I do believe). Eg: you can directly access cells in other sheets, you write a normal formula for the top left cell of the range you are applying to. My actual validation formula is given below.
=SWITCH(WorkArrivals!D11,
-500,ISBLANK(D11),
-400,ISBLANK(D11),
-200,AND(NOT(ISBLANK(D11)),OR(AND(ISNUMBER(D11),D11>0,D11<1),NOT(ISERROR(SEARCH("|"&D11&"|","|absent|sick|annual|family|domtravel|inttravel|"))))),
-100,OR(ISBLANK(D11),AND(ISNUMBER(D11),D11>0,D11<1),NOT(ISERROR(SEARCH("|"&D11&"|","|domtravel|inttravel|")))),
AND(NOT(ISBLANK(D11)),OR(AND(ISNUMBER(D11),D11>0,D11<1),NOT(ISERROR(SEARCH("|"&D11&"|","|absent|sick|annual|family|domtravel|inttravel|")))))
)
Tips:
No way to validate NOT(ISBLANK()) as (it appears) validation is triggered when data is entered ONLY.
Similar to Conditional Formatting, it appears that the whole (applied) range is validated and NOT just the cell that was updated. There is a (background active progress bar) lag (~2s for range(1000 rows, 15 cols) - so use with caution on large ranges. #Google could make this smarter ?
Solved thanks to Jeremy Kahan (below). For the benefit of other users;
My issue was, I was trying to apply Conditional Formatting rules to Conditional Validation, but apparently they are quite different in terms of their application (I do believe). Eg: you can directly access cells in other sheets, you write a normal formula for the top left cell of the range you are applying to. My actual validation formula is given below.
=SWITCH(WorkArrivals!D11,
-500,ISBLANK(D11),
-400,ISBLANK(D11),
-200,AND(NOT(ISBLANK(D11)),OR(AND(ISNUMBER(D11),D11>0,D11<1),NOT(ISERROR(SEARCH("|"&D11&"|","|absent|sick|annual|family|domtravel|inttravel|"))))),
-100,OR(ISBLANK(D11),AND(ISNUMBER(D11),D11>0,D11<1),NOT(ISERROR(SEARCH("|"&D11&"|","|domtravel|inttravel|")))),
AND(NOT(ISBLANK(D11)),OR(AND(ISNUMBER(D11),D11>0,D11<1),NOT(ISERROR(SEARCH("|"&D11&"|","|absent|sick|annual|family|domtravel|inttravel|")))))
)
Tips:
No way to validate NOT(ISBLANK()) as (it appears) validation is triggered when data is entered ONLY.
Similar to Conditional Formatting, it appears that the whole (applied) range is validated and NOT just the cell that was updated. There is a (background active progress bar) lag (~2s for range(1000 rows, 15 cols) - so use with caution on large ranges. #Google could make this smarter ?

Glitchy Data Validation Custom Formula

=COUNTIF(IMPORTRANGE("[spreadsheet_id]", "$L:$L"), L2) <= 1
I'm using the above formula in my data validation rule to make sure all values are unique. The sheet referenced is a master list of different ranges combined (also using IMPORTRANGE) so I can check for uniqueness across multiple spreadsheets.
The formula is fine, but the validation does not work normally. I made sure I authorized access to the spreadsheet beforehand, but I've noticed some glitchy behavior. When I take that same formula and put it in a cell on the sheet and then resave the data validation rule, it somehow seems to get it working. But when I remove it again, it doesn't.
Is this normal behavior? Do I have to have a cell with the same formula on my sheet for it to work?

Exporting values of unchecked items in Google Forms checklist

Using Google Forms checkboxes to collect survey responses into a Sheets doc, I find that I can only get the values of checked lines to fill the spreadsheet.
I'm trying to get the unchecked CheckBox values to fill a different cell in the spreadsheet as well, has anyone found out a way to do this?
I'd appreciate any help!
I have a way with spreadsheet formulas.
The drawbacks are the necessities of
manual input of all possible options
copying and pasting a formula for each response (can be done in advance, but if not enough formulas are pasted for the number of responses, the sheet will break)
An ideal solution would automatically detect all possible responses, and could theoretically accept an infinite number of responses without breaking and needing maintenance.
With that said, he's an example of what I suggest:
Google Sheet
Google Form
All possible options on the form must be typed into cells A2:A
cells B2:B show comma+spaces if the corresponding cell in A2:A is not blank, with =arrayformula(if(isblank(A2:A),"",", ")). These commas and spaces are needed later in a concatenate().
Raw data from the Form Responses spreadsheet was brought into D2:E with =arrayformula('Form Responses 1'!A2:B)
G2:G holds the important formulas. They must be copied and pasted to each individual cell for each row.
First, all possible responses in $A$2:$B are filtered based on if the cell in column A can be found in the text in column E.
=filter($A$2:$B,arrayformula(iserror(search($A$2:$A,E2))))
Next, some error catching. I added an iferror() to catch a "N/A, no results found in filter evaluation", and an if(isblank(),"",) to catch if no timestamp is in column D meaning no response was recorded in this row.
=if(isblank(D2),"",iferror(filter($A$2:$B,arrayformula(iserror(search($A$2:$A,E2)))),""))
Finally, do a concatenate() to pull the values and the comma+spaces all into one string inside one cell.
=concatenate(if(isblank(D2),"",iferror(filter($A$2:$B,arrayformula(iserror(search($A$2:$A,E2)))),"")))
Oh, and if you don't like the comma+space being the last characters in the string, in J2:J I did a =arrayformula(iferror(left(H2:H,len(H2:H)-2),"")) which cuts off the last 2 characters of the string in column H.
If I come up with a better solution, I'll let you know. It's an interesting puzzle to solve.

Resources