I have a group of respondents (e.g. 4), each answering a few questions (e.g. 10 questions).
The questions belong to 3 groups (Basic, Advanced, Other).
I want to calculate the Standard deviation for each group (STDev for the Basic questions, STDev for the Advanced questions, STDev for the Other questions).
How can I do that?
Here's an example google sheet, where A:K are the answers of the respondents and M:N is the grouping of the different questions. I want the Standard deviations, per group, in column Q using a formula.
https://docs.google.com/spreadsheets/d/10CjMTFVU5qmGbKmqeo2FxuSf2G712cKxYliBN0cE7KU/edit#gid=0
use:
=STDEV(FLATTEN(FILTER(B$2:K$5, REGEXMATCH(B$1:K$1&"",
"^"&TEXTJOIN("$|^", 1, ""&FILTER(M$2:M$11, N$2:N$11=P2))&"$"))))
arrayformula:
=BYROW(P2:P4, LAMBDA(x, STDEV(FLATTEN(FILTER(B$2:K$5, REGEXMATCH(B$1:K$1&"",
"^"&TEXTJOIN("$|^", 1, ""&FILTER(M$2:M$11, N$2:N$11=x))&"$"))))))
try:
=STDEV(FILTER(B2:K5,XMATCH(B1:K1,FILTER(M2:M11,N2:N11=P2))))
Related
This question already has answers here:
How to list all permutations without repetition?
(2 answers)
Closed 5 months ago.
Say I have a set of seven unique trading cards and I want to shuffle them and list them out for all their possible permutations (pool of 7, taking 7). No card may be duplicated within each permutation of an arrangement as I have only one of each card, and I am not looking for the number of permutations available. I want the list itself.
How would I use one Google Sheets formula (no manual data entry on an iterative basis past the first line) to shuffle these cards: A, B, C, D, E, F, and G into a list of unique permutations per row? They can be arranged into a tidy list (ABCDEFG) within each cell or each card to a column, but along each permutation, there must only be one of each card (ABACDEF shouldn't exist).
I've looked everywhere to shuffle just one column of values into all possible ordered sets with no repeated objects per set. Still, I lack the remembered terminology to search for the right answer.
If you know about the solution, give me the link please.
https://webapps.stackexchange.com/questions/129778/is-there-a-formula-to-list-all-possible-2-card-combinations-of-4-playing-cards-i
Reducing the question to trading cards for this post inspired me to pose it that same way to Google, and I found this. I believe the above example may be scaled up to 7 in 7 cards.
Feel free to try coming up with a better answer... I noticed the formula in the above post is rather long. I'm looking for the most compact answer available.
EDIT: Aha! I think I found one better.
Generate all possible combinations for Columns(cross join or Cartesian product)
I was having issues running into the rept function's 32000 character limit. So, I added the lengthy transposition formula found here:
https://stackoverflow.com/a/73523983/4143583
Combining that formula within a query similar to the first link's answer but scaled up a bunch ("where Col1 <> Col2 and Col2 <> Col3", etc.) seems to have solved my issue with repeated members within each permutation.
I have a table like this, with the current table in blue, and the desired results highlighted in yellow:
And my goal is to set up a query in Google Sheets using their built-in =QUERY() function (note: based on the Google's own Query language, which is very similar to SQL) that can essentially do this entire table, without adding extra formulas. I know how to find the monthly averages separately, in a style like
SELECT month(DateRun), average(metric) GROUP BY month(DateRun)
But how could you have it so it's like
SELECT AdID, DateRun, Metric, average(Metric for Associated Month), IndividualMetric - AverageForMonth
I have tried to find it on my own, but have not been able to find a resource that I'm able to transform for my own usage.
I learned sub-queries a while back, and have a feeling that maybe the answer to this but I am very lost.
Please let me know if I can provide any additional information.
try:
=ARRAYFORMULA(IFNA(VLOOKUP(MONTH(B2:B),
QUERY(B2:C, "select month(B)+1,avg(C) group by month(B)"), 2, 0)))
and:
=ARRAYFORMULA(IF(B2:B="",,C2:C-D2:D))
UPDATE:
You seem to be looking for a window average:
select
AdID,
DateRun,
Metric,
avg(Metric) over(
partition by Metric, date_trunc(DateRun, month)
) month_avg_metric,
Metric - avg(Metric) over(
partition by Metric, date_trunc(DateRun, month)
) diff_with_month_avg_metric
from mytable
The last but one column in the resultset gives you the average of the metric for the on-going month, and the last column computes the difference between the current metric and its monthly average.
I'm making a roster of sorts and would like to award points to people's names when they attend events. For example, we use 4 possible responses; Attended, Late, Absent and AWOL. Essentially, Attended will award 2 points, Late will award 1, Absent 0 and AWOL will deduct 2.
We have a main "database" sheet with everyone's information and then a sheet with attendance. I'd like to use QUERY(select where) to determine the right name to add the points to.
I don't fully understand the Query function and its limitations which is why I thought I'd ask here as I'm sure most of you are 10x as knowledgable as I am with Google Sheets. I thought about just using =if(A1='Second sheet'!A2) etc. but remembered about the query function which is able to help automate this process much more.
This is where I'd like the points to be shown on the "Database" sheet.
And this is the data on the "Attendance" sheet.
=ARRAYFORMULA(IF(A2:A<>"", MMULT(IFERROR(
SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(C2:D,
"Attended", 2),
"Late", 1),
"AWOL", -2)*1, 0),
TRANSPOSE(COLUMN(C2:D))^0), ))
=ARRAYFORMULA(IFERROR(VLOOKUP(F8:F, Attendance!A:B, 2, 0)))
I have a table in the link below:
https://docs.google.com/spreadsheets/d/1EOALaBVzHijUP_8dM1Sr7KTutdTah8b9Q0xDRoNHBLo/edit#gid=0
if the text is split first, then check what do you do? for example "Kebumen District Office" Vs "District Head Office of Kebumen District" Then we need 7x7 columns = 49 columns because we will match for each word words 1-1, 1-2, 1-3, 1-4, 2-1, 2-2.2-3.2-4, etc.
The text in column B is split and then checked for each word with the text in column A. If in column B there are many different words found the text is not similar.
Only I am still confused to make the formula. Please give me the solution sir. Thanks.
The matching patterns are very different in your case and I see no solution based on formulas (regular expressions).
You may need to find articles about fuzzy vlookup.
Here's what I found for google sheets (not tested):
Addon, find fuzzy matches
This problem is common for Excel, there're solutions based on vba.
As I said, the one formula won't solve your task because you have many cases. First example Mc Donald vs McDonald is checked easily with a formula:
= substitute(A, " ", "") = substitute(B, " ", "")
Your next samples are different. You may use some code, but even this won't give the expected results. My suggestion: split the task into small cases and try to solve them separately. Make an investigation or ack a new question for each case.
Your second and 3-d lines are case2. In this case, you need to check all the words in A are also in B. You'll need to try solving it and ask another question if needed. And so on.
Fuzzy matching is definitely the way to go. Different algorithms have different strengths and weaknesses. My suggestion is that you visit the G Suite marketplace and look for Flookup or simply follow this link:
Flookup for Google Sheets
It'll allow you to look for matches ranging from 0% to 100% similarity. The basic formula is:
FLOOKUP(lookupValue, tableArray, lookupCol, indexNum, [threshold], [rank])
Find out more from the official website.
Edit: I'm the creator of Flookup.
I have a Google Form linked to a Google Sheet. The form consists of twenty questions, all of which are answered by a 0, 1, 2, 3, 4, or 5 response. In the sheet, there are 20 columns that correspond to the questions. Each row is the response of one subject.
Now the tricky part: there are six additional columns that sum all the 0's, 1's, 2's, 3's, 4's, 5's. For example, if a subject answers three of the questions with a value of 3, the value of 9 will populate the "3" column. I have been successful using the SUMIF formula, but copying and dragging down the column doesn't work because of the Google Form integration.
I understand the premise of array formulas, and I have discovered that it doesn't work with SUMIF.
I have spent the better part of two days searching for solutions including combining SUM and FILTER, HLOOKUP, and MMULT. I just can't solve this.
Any help is much appreciated.
Rich
Aggregating functions such as sum() will not produce multi-cell results in an arrayformula() wrapper.
Some other aggregating functions that are not conducive for use in an array formula are listed below with examples of workarounds for producing row-by-row results.
and, avarage, count, countif, counta, concatenate & join, max & min
The sample file with more examples:
Make a copy
Sumif
={"Mmult" ; MMULT(FILTER(B2:H * (B2:H = 3), A2:A<>"") , ARRAYFORMULA(TRANSPOSE(COLUMN(B1:H1)^0))) }
Mmult function works slow, but I can't find a better solution.