google sheets - Arrayformula - google-sheets

I have created a form using google forms, and I want to automatically check the answers when a new submit is done.
When the user submit his/her question, a new line is added in a responses sheet. This is where I need to add some magic ;)
SO, in my responses sheet, I have the right answers in the second line...something like this
A B C
1
2 RightAnswer1, RightAnswer2, RightAnswer3....
Using the arrayformula function, I have added new colums (column D,E,F,G and so on) on every row checking against the correct answer on line 2.
The formula goes something like this;
=IF(ARRAYFORMULA(A3:A=A2),1,0)
And it works like a charm :)
BUT, then I want to add a column at the end of each row with the sum of all the right answers, lets say to column Z on every row...this is where I want to sum all the 1's (correct answers).
I have tried something like this;
=IF(ARRAYFORMULA(<any kind of check that is true>),sum(D3:Z3),0)
This will always return the sum of D3:Z3 on every line, and this is not what I want. I want to sum the columns on the line-number that was just added. So I have tried to alter this expression in several ways , having everything in the arrayformula expression, altering the sum expression to (D3:D) to hopefully get it to work on the current line, but without any luck.
I have search the web for answers, but found nothing to help me...
Do you have any suggestions?

One way:
=ArrayFormula(IF(LEN(D3:D),SUMIF(IF(COLUMN(D3:Z3),ROW(D3:D)),ROW(D3:D),D3:Z),))
Although it would be possible to "skip the middle man" and process the raw data alone; assuming the answers are in A2:Z2, and the data to sum is in A3:Z, then:
=ArrayFormula(IF(LEN(A3:A),COUNTIF(IF(A3:Z=A2:Z2,ROW(A3:A)),ROW(A3:A)),))

Related

Taking Column A values comparing to Column B values if they are the same post to Column C

I'm trying to take the names from column A compare them to the names in column B and then have the similar names get listed in column C.
The problem is these names are automatically updated and out of order, and I need the function in column C to update with them. Also, the names will not be in order, this is why I can't use A=B function. The picture shown is an example of what the solution would look like or something similar. After completing this, I would like to continue using the same function to break down the name data even more. Watched a lot of videos on this, can't find anything specific enough to work.
Side note, I have found a way to do this using different pages within the sheets but not in the same sheet side by side. ex. of what solution
I have tried watching lots of YouTube videos, but nothing goes into detail enough and seem to only explain when similar values are next to each other in column A and B.
This is what I use for 2 different sheets but can't find / understand why when changing values in function to single sheet it wont work:
=filter(Sheet1!A2:B,ISNUMBER(match(Sheet1!A2:A,Raid1!A2:A,0)))
Also, another side note: Can't use True or False. And for uneven number of names in the list ex. Column A has 10 and B has 7 it sorts A for names in B and post similar in C.
Try below formula-
=FILTER(C3:C,INDEX(COUNTIFS(D3:D,C3:C))>0)
You can use VLOOKUP to check common values between columns and store them in another column.
=IFERROR(VLOOKUP(A:A,B:B,1,false),"")
Although this will create gaps in the output column. you can get rid of it by by simply using a filter or so.
all you need is:
=FILTER(C3:C; COUNTIFS(D3:D; C3:C))

Google sheets, two-sheet dependent conditional formatting

My problem is probably trivial ... However, I was looking for similar problems and their solutions either do not work for me or I can not apply them.
I have 2 sheets - SheetA and SheetB. They are identical. I want to select every cell in SheetA that is no longer identical to Sheet B.
I was able to use (found here on Stack Overflow) such a function in conditional formatting:
= A1 <> INDIRECT ("SheetB! A" & ROW ())
It works if the range is column A. I know that I can apply this function to each column separately, but there is certainly a way that I can apply the same formula to the whole worksheet.
Will there be anyone who can show me the correct formula?
Edit: I tried to use above formula to every column... And my file become to work very slow... So whoever wants to do the same... think again.
After some tries I decided to move everything from SheetB to SheetA. I paste it a 1000 rows under data of Sheet A. Works fine without "indirect" function. No slow downs. It is not a perfect solution but it works.
But even after my problem is solved different way, I would like to know what is the correct formula for my problem... it might be useful for the future with smaller amount of data.
Solved ;)
You should be able to use the Address function to get the address of the current cell from its row and column:
=A1<>indirect("sheetB!"&address(row(),column()))
or for case-sensitive match:
=not(exact(A1,indirect("sheetB!"&address(row(),column()))))

Can I set up a Google Sheet to copy everything from another sheet, except for cells with a specific word count?

I have a Google Form set up, and anybody can submit a response an unlimited number of times. (It has to be this way. I can't make people log in.)
The issue is that there's a spammer who's using some website or bot to submit thousands of spam responses. I've tried using the captcha add-on from xfanatical (which adds a question that makes them fill out a particular code, which changes every minute), but the spammer figured out how to get past that.
One thing I've noticed, though, is that each spam submission is exactly 100 words. So one way I can think of to solve this is to have a sheet that returns all rows from the "Responses" sheet except for the rows where the submission is exactly 100 words.
Edit: I've also noticed that all the submissions start with a space, so that could be used too.
Let's say that your Responses 1 sheet has the answers in columns A, B, C, D, E etc. all the way to column Z
Let us now suppose that it is column C that holds the answers that start with a space.
Follow these steps:
Please create another tab and name it Clean.
Place the following formula in another cell A1
=QUERY('Clean'!A1:Z,"select * where not C matches '\s.*'")
Enjoy a spam free answer sheet :)
As mentioned by the OP, one can also use
=QUERY('Responses 1'!A1:Z,"select * where not C starts with ' '")
Functions used:
QUERY

Google Spreadsheet & ArrayFormula - auto-adding formulas

I'm having problems with something that is likey very simple to correct. I have a form that submits data to a Google Spreadsheet, simply a date, name and score. On a separate sheet I am going to have a leaderboard which shows all submissions ranked by highest score (for simplicity in the example in the link below, I just have the leaderboard showing up on the right of the same sheet). I have it sorting the data fine, but I'm struggling with getting the 'rank' value to display. As shown for the first 3 rows (G2, G3, G4) I know what the formula is to display the 'rank' value...but what I'm struggling with is how to get that value to show without having to have that formula in each cell. Since the data will be coming from a form, there will obviously be new rows added regularly which means the leaderboard will automatically get adjusted and I want all of the rows to display the rank #. From what I have read, ArrayFormula should allow this to work, but even with looking at examples I can't figure out how to get it to work with my formula.
I know I could just highlight the entire 'G' column and paste in the formula, and hope it adds it to enough rows...but then it displays 'N/A' for all of the rows which don't currenlty have any data.
Hoping its just a simple solution that I'm being dumb and missing...any help would be greatly appreciated. The link to an example is below. To summarize, for all rows that have content in column H and I, the G cell for that row should show the rank value automatically.
https://docs.google.com/spreadsheets/d/1pCIJQi5g2scOtB6o2PgVVb-0azzhupEOPjiL0RMM57A/edit?usp=sharing
Thank you!
=ARRAYFORMULA(RANK(INDIRECT("I2:I"&COUNTA(H:H)),$I$2:I,0))
This will automatically rank and sort, for all values, including additional ones that are added. You only need to enter it into G2, and it will dynamically fill in the rest for you.
You can use
IFERROR(RANK(...),"")
and drag it to all rows - this will leave blank cells instead of #N/As. I'm sure there are other ways but that seems like the easiest one to me.

SUMIF with FIND as criteria

I'm trying to summarize data from several Google spreadsheet' sheets in a single one but I have some issues with SUMIF and FIND.
To Sum data from another sheet I have to use this (at least that's the only solution I've found)
=SUM(INDIRECT(""&A6&""&"!E2:E"))
Where I have the name of my sheet on A6.This makes everything easy because I have a column (A) with all the names of the sheets. I haven't found something like Sheets[1] in Google Docs.
My next step was to Sum Times from a specific column but remove a specific values, which in this case is 1 that get transformed internally 24:00:00 since it's a time column:
=SUM(INDIRECT(""&A6&""&"!D2:D")) - SUMIF(INDIRECT(""&A6&""&"!D2:D");"24:00:00")
Here I tried to do everything with a single SUMIF but I have no idea how. NOT("24:00:00") didn't work so I settled to this.
The last part is the most difficult and I'm not able to solve it.
I have a column with month names (for example) and I want to sum some data only when the month name contains "er". Here is what I thought:
=SUMIF(A6:A16,ISNUMBER(Find("er")),G6:G16)
This gives me always 0
(Note that the last one contains A6:A16 instead of the whole INDIRECT part because I am still testing it in a single sheet.)
Any Idea what I'm doing wrong?
I don't know why the above SUMIF doesn't work, what I've tested and works is:
=SUMIF(A6:A16,"*er*",G6:G16)
SUMIF is NOT SUM + IF as I thought. I hope it will help someone else.

Resources