Count Number of Cells with Invalid Data Validation Values - google-sheets

I've been scratching my head at this issue. I have Google sheet with a Data Validation that uses a List from a Range that creates a Drop Down with values listed.
When I type something that isn't found in the list of possible options, it will return the error message saying 'Input must fall within specific range'
I have about a ton of these cells going across the sheet from F2:Z2
All I want to be able to do is count the amount of cells that return this type of error message.
I've tried using COUNTIF, but I am not trying to found instances of a specific text in the box, I'm trying to count the amount of cells that don't pass validation.
I've also tried doing...
=COUNT(IF(ISERROR(F2:Z2),1,""))
However, apparently Sheets doesn't count it as an actual error?

The iserror() function will only return true when the cell contains an error value. Your drop-down list cells do not contain error values but values like Junior Technician 3rd Grade.
To count the values that do not appear in the validation list, compare them directly to the range that holds the allowed values, like this:
=counta( iferror( filter( F2:Z2, isna(match(F2:Z2, DropDownLists!A2:A, 0)) ) ) )

Related

Return Row Data if a Name is Found in a Column

I have a table with names on the left and corresponding work schedules to the right. I've created a separate table with some of those same names and want it to automatically fill in the corresponding work schedule for that person. Seemed simple but I'm very stuck. My level of experience with Google Sheets is what is stopping me from solving this.
Example Tables:
In the attached picture the table on the top is the original (hardcoded) data. The table on the bottom is where I want the schedule data to be automatically produced based on the name on the left. The fields with #N/A and #ERROR! are both failed formulas I tried. #N/A should have returned B7:G7. #ERROR! should have returned B4:G4.
I tried the 'LOOKUP' function with ARRAYFORMULA(INDEX) hoping to have it look up the value in the column and input the work schedule data that corresponds.
=LOOKUP("Clair",A1:A9,ARRAYFORMULA(INDEX(B1:G9)))
yielded an #N/A.
Started trying to use =If(REGEXMATCH(A13:A21,"Clair"),... ...) but the '... ...' shows where my intellectual limits are at the moment. I couldn't finish it because I think it's the wrong formula to use.
Something like this maybe?
Remove everthing in B13:G17, and put this formula in B13
=BYROW(A13:A17,LAMBDA(NAME,XLOOKUP(NAME,A1:A9,B1:G9,"NOT FOUND")))
BYROW() work with an array row by row, the given data A13:A17 has only 1 column, which is the name of staff as lookup value.
Details: https://support.google.com/docs/answer/12570930?hl=en
XLOOKUP() scan an array for a key value (lookup value), and return another array with corresponding row or col index.
Details: https://support.google.com/docs/answer/12405947?hl=en
try:
=INDEX(IFNA(VLOOKUP(A13:A17; A1:G10; SEQUENCE(1; 6; 2); )))

Compiling a list using INDEX but need to skip certain rows

I'm compiling a list based on the first answers recieved between row N and AF.
I'm using these two formulas:
=INDEX(N2:O2,MATCH(FALSE,ISBLANK(N2:O2),0))
and
=INDEX(R2:AF2,MATCH(FALSE,ISBLANK(R2:AF2),0))
Is there a way to combine them whilst not searching in rows P & Q?
These are generated from a Form response so can't just be switched around.
try:
=INDEX({N2:O2, R2:AF2}, MATCH(FALSE, ISBLANK({N2:O2, R2:AF2}), 0))
If Sheet1 is an intake sheet of form results, you should not add any data, formulas or even formatting to that sheet. It virtually always causes issues. A form intake sheet should be left exactly as it is. A new sheet can then be used to bring over the results of the form intake sheet as you want to see them.
However, since you didn't specify any of that, I will supply a formula written to work in the same sheet as your posted example and in-sheet examples.
Clear an entire column and place the following in the top cell of that column:
=ArrayFormula({"Attendee Name"; IF(E2:E="",,IFERROR(REGEXEXTRACT(TRIM(TRANSPOSE(QUERY(TRANSPOSE(FILTER(IF(N2:AK="",,N2:AK&"~"),N1:AK1=N1)),,COLUMNS(N1:AK1)))),"\s*([^~]+)"),"(none listed)"))})
This one formula will produce a header (the text of which you can change within the formula itself as you lie) and all valid results for all rows.
The inner IF will append a tilde (~) to any non-null entries in the range N2:AK.
FILTER will keep only those columns in this range where the header is the same as the header in N1 (i.e., "Attendee Name").
TRANSPOSE(QUERY(TRANSPOSE( ),,COLUMNS( ))) is colloquially called a "Query smash." It will form one cell from all horizontal results per row.
TRIM will cut any preliminary spaces and form a true string.
REGEXEXTRACT will pull the from the first non-space character up to but not including the first tilde (from those appended in the first step)—in other words, the first full valid entry from any column.
IFERROR will return a message if there is an error, with the likely error being that there were no valid entries for "Attendee name" in any column.
The outer IF will leave the cell blank if the no training event exists in E2:E.
{ } forms a virtual array that places the header over all other results.
ArrayFormula( ) signifies that multiple results will be processed at once.
Because this is an array formula that is being "asked" to process every row, you cannot manually type into any cell of this results column. If you do, you will "break the array"; everything except what you just typed will disappear, leaving only an error in the formula cell. If you need to add or change a name, you need to do that in the raw results range (e.g., manually type a name or a new name in Col N), which will then turn up in the formula output range.

Google Sheets - IF statement with INDEX arguments giving me #ERROR (Parse Error)

To give some detail, I am using Google Forms + Google Sheets to make an easy database that collects all the bank information I put in (Income, savings, expenses, etc.) and I can keep track of details with easy sorting.
I'm stuck on a formula that I can't seem to figure out. Before I go in to specific details of my code I will give a small explanation. The cell I am trying to populate [with the formula] is supposed to take 2 pieces of information from the form response sheet (I will refer to it as 'rawdata') and produce a value (number) from another cell in 'rawdata'.
So in 'rawdata' I have a column (B) that has a value of "Expense" or "Income" for a form response line. I have a column (D) in 'rawdata' that has the value of "Amount" for the number submitted.
Cells in reference in 'rawdata':
B9 = "Expense"
D9 = 67.37
Now, due to the original 'rawdata' being a form response sheet it inserts new rows every response, so my attempt at just calling direction to the cell fails upon a new response submission because it increments on its own. So that being a solution is out of the question.
So, for every other cell I am using to display values from 'rawdata' in an organized sheet I use =INDEX() to pull the value from that exact row and column, instead of the cell reference and it has worked so far.
=INDEX(rawdata!$B:$B,ROW(9:9)) displays "Expense" from 'rawdata' in B9 as a result. So the rest of the cells are formulated this way and I have had no issues.
When I got to the amount, I used an =IF() formula to pull the value from the D column and to display it either as a negative or positive depending on what column B states.
=IF(rawdata!B8="Expense", -rawdata!$D9, rawdata!$D9) displays -67.37 as a result.
But since I can't use this formula to fill empty cells for future use I have to find another way to do so. I figure;
=IF(=INDEX(rawdata!$B:$B,ROW(9:9)) = "Expense", =INDEX(-rawdata!$D:$D,ROW(9:9)), =INDEX(rawdata!$D:$D,ROW(9:9)))
is my solution to the problem, because to me it makes sense. But it fails and gives me a Parse Error.
So when I try to run the first =INDEX() with the values of 1 or 0 being the outcome of the =IF() it also fails, so I create a new column in the sorted table to pull the data of "Expense" or "Income" so I can reference that.
Cell in 'processeddata':
E9 = "Expense"
=IF(E9="Expense", 1, 0) displays 1 as its result, so I figure this is the solution to my problem.
=IF(E9="Expense", =INDEX(-rawdata!$D:$D,ROW(9:9)), =INDEX(rawdata!$D:$D,ROW(9:9)))
displays #ERROR with the description Parse Error.
=INDEX(-rawdata!$D:$D,ROW(9:9)) displays -67.37
=INDEX(rawdata!$D:$D,ROW(9:9)) displays 67.37
I'm at a loss for what to do now. I've exhausted myself with tons of searching on here and all over google, tried using things like INDEX and MATCH, VLOOKUP, etc but can't solve this to save my life. Does anyone here have a clue how I can solve this with a cell reference that won't increment when new rows are added in 'rawdata'?
PS. I've also attempted using =VALUE() to try and convert the =INDEX() to a number but no luck.
Your formula has superfluous equals signs (=). Try Insert > Column and this formula in row 8 of the new column:
=arrayformula( if(rawdata!B8:B = "Expense", -rawdata!D8:D, rawdata!D8:D) )
Your formula has some equal signs in it that are probably the issue.
Instead of this:
IF(=INDEX(rawdata!$B:$B,ROW(9:9)) = "Expense", =INDEX(-rawdata!$D:$D,ROW(9:9)), =INDEX(rawdata!$D:$D,ROW(9:9)))
try this:
IF(INDEX(rawdata!$B:$B,ROW(9:9)) = "Expense", INDEX(-rawdata!$D:$D,ROW(9:9)), INDEX(rawdata!$D:$D,ROW(9:9)))
Also, an array formula is a great tool for Form data calculations. In this file you can see a formula in Column F that does a calculation in each row of the responses sheet from this form, it will continue to update as new entries are made. Feel free to enter submit some form responses.

#REF! error in google sheets

I have a spread sheet which can be viewed at https://docs.google.com/spreadsheets/d/1bhIV1ULLXhjdSO_5Q5l5ZNe7Zaxrj15CYMW88FMFgRU/edit?usp=sharing
The way the spread sheet works is when a selection from the list is made the specific cells reference a data table and fills in the respective cells. This works perfectly in excel and I just use Iferror to hide the circular references. This is not the case in google sheets as the #REF! error still appears. How can I rectify so that they no longer appear? I have tried unique but it makes all the cells bank even when a different selection from the drop down box is made.
You can use the ISREF() function for this. Combine it with an IF() and you're good to go:
IF(ISREF('sheetname'!A4), 'sheetname'!A4, "")
The problem is that the formula itself is fine but (for column N) 'Attributes-InSeason-Trade_Mach'!$L121 and the following rows evaluate to "".
This means for INDEX in Google Spreadsheets that it will use all rows which in turn would overwrite the data in the next row because INDEX will be returning a range, not a single cell.
The Formula itself is evaluating fine, it does not cause an error which is why IFERROR does not trigger the alterantive "", the problem happens after the evaluation when it is trying to display the data.
You can just wrap the INDEX Call inside of an IF like this (This is an example for Column N)
=IFERROR(IF('Attributes-InSeason-Trade_Mach'!$L110 <> "",
INDEX('Attributes-InSeason-Trade_Mach'!$H$110:$I$214,
'Attributes-InSeason-Trade_Mach'!$L110,
COLUMNS(Trade_Machine!$P$4:P4)), ""), "")

Return only filled cells in Google Sheets QUERY

I have this formula in my sheet:
=query('Character Analysis'!$H62:$L83,"select H,I,J,K,L where H is not null order by L DESC",0)
Only the first two of the source rows have data in them, but on the sheet with the query formula it appears to be pulling all the rows in the range, even the blank ones. If I type something in the 3rd row on the query formula sheet, it gives me an error saying "Array result was not expanded because it would overwrite data in ________." But it doesn't need that room because there are only two rows of data in the query result.
I tried adding the "is not null" language in hopes that it would limit the returned result to only filled cells, but it's not working.
How can I tell my query to only pull data from filled cells in the source range?
I figured out a workaround, at least to the degree that it works for me. It's not a true answer as I'd still like to know why the "is not null" language isn't working, but this is giving me exactly what I need: You can just limit the number of returned rows to the number of source rows with data by counting them:
=query('Character Analysis'!$H62:$L83,"select H,I,J,K,L order by L DESC limit "&COUNT('Character Analysis'!$L62:$L83)&"",0)
According to source
You can:
Using a ‘where’ clause to eliminate blank rows
If a named range is defined using entire column (ie including blank rows) you may find these blanks appear in the query result (which, depending on the sort order, could be at the top!). To stop these appearing include a where clause using this syntax (assuming column A):
"...where A <> ' ' " (for text fields)
"...where A <>0" (for numeric fields)
This means ‘where values in column a are not zero-length text.

Resources