Is it possible to write a sum-formula in Google Sheet that would add together all the values in the E-column which number in the F-column for example is "2"?
Visual example
Hope the question makes sense,
solution #1
Make a pivot table
solution #2
=QUERY(E2:F,"select F,sum(E) where F is not null group by F ")
Related
I have a table like this one here (basically it's data from a google form with multiple choice answers in column A and B and non-muliple choice data in column C) I need a separate row for each multiple choice answer.
Column A
Column B
Email
A,B
XX,YY
1#gmail.com
A,C
FF,DD
2#gmail.com
I tried to un-nest the first column and keep the remaining columns like this
enter image description here
I tried several approaches I found with flatten and split with array formulas but I don't know where to start really.
Any help or hint would be much appreciated!
You can use the split function on the column A and after that, use the index function. Considering the table, you can use:
=index(split(A2,","),1,1)
The split function separate the text using the delimiter indicated, returning an array with 1 line and 2 columns; the index function will return the first line and the first column from this array. To return the second element from the column A, just change to
=index(split(A2,","),1,2)
I think there's no easy solution for this. You're asking for as many combinations of elements as multiple-choice elections have been made. Any function in Google Sheets has its potentials and limitations about how many elements it can express. One very useful formula here is REDUCE. With REDUCE and sequences of elements separated by commas counted with COUNTA, you can stablish this formula:
=QUERY(REDUCE({"Col A","Col B","Email"},SEQUENCE(COUNTA(A2:A)),LAMBDA(z,c,{z;LAMBDA(ax,bx,
REDUCE({"","",""},SEQUENCE(ax),LAMBDA(w,a,
{w;
REDUCE({"","",""},SEQUENCE(bx),LAMBDA(y,b,
{y;INDEX(SPLIT(INDEX(A2:A,c),","),,a),INDEX(SPLIT(INDEX(B2:B,c),","),,b),INDEX(C2:C,c)}
))})))
(COUNTA(SPLIT(INDEX(A2:A,c),",")),COUNTA(SPLIT(INDEX(B2:B,c),",")))})),
"Where Col1 is not null",1)
Since I had to use a "initial value" in every REDUCE, I then used QUERY to filter the empty values:
I have a google sheet with multiple tabs, one of the tabs is for holding each observation of data while another needs to combine data based on certain criteria. I am trying to use a SUMIFS within and ARRAYFORMULA to get the correct information and it will only pull "0" no matter what I try.
I have set up a test google sheet with some dummy information to show an example of what I need to do in a more complex situation.
https://docs.google.com/spreadsheets/d/1JLyEuVijQ8MvfOKrtbRD_YKmRDnTCxf7qCSw9Ggty_Y/edit#gid=1250575550
In this example, the data tab is the individual observations and the sums tab is where I'm trying to pull combinations. I need column D to sum the totals in column E on the data tab if the Month and Year and Type all match what is on the sums sheet. In this example, cell D3 on the sums tab should equal 11.
you cannot use SUMIFS() in Arrayformula(), along with many other functions, though there is no formal documented list.
In your case you can use a SUMIF() instead by &'ing the condtions together.
I've demoed the concept on a new tab called MK_Help in cell D2:
=ARRAYFORMULA(IF(ROW(A2:A) = ROW(A2), "# TOTAL TYPE", IF(A2:A = "", , SUMIF(data!A:A&data!B:B&data!C:C,A2:A&B2:B&C2:C,data!E:E))))
Note that I made a couple of other small changes to your formula.
Namely, that you should always use a true "empty" instead of double quotes in your IF() mask up front tor return empty when there's no value in A. Double quotes("") is actually not quite empty for many other things in Google sheets.
Also I modified your header conndition from ROW(A2:A)=2 to ROW(A2:A) = ROW(A2). I find that this is a more flexible condition for the header as it allows you to potentially insert/delete rows above the header without breaking things.
It seems QUERY() may be good choice. Try-
=QUERY(data!A2:E,"select A,B,C, sum(E) where A is not null group by A,B,C",1)
If you need specific month then you can add criteria to where clause like-
=QUERY(data!A2:E,"select A,B,C, sum(E) where A =5 group by A,B,C",1)
I have a following formula in my google sheets
=TEXTJOIN(" -- ",TRUE,QUERY('sheetName'!B2:F,"SELECT F WHERE B = '"&$A3&"'"))
The formula is in a different sheet, same workbook though, let's call it "sheetResult". Basically it looks-up values and returns them if there is a match. There are two things I would like to achieve with it further. I need it to be an array so that it applies to all of the rows and I need it to return only the unique values found, I have tried the following but it does not work.
=ARRAYFORMULA(IF(A2:A = "" , , TEXTJOIN(", ",TRUE,UNIQUE(QUERY('sheetName'!B2:F,"SELECT F WHERE B = '"&$A2&"'"))) )) --> not sure what syntax to use
I tried filter but filter just returns all of the info stacked up, need the formula to return the data considering the rows in which the lookup value is held.
EDIT: Added a link to shared file to better describe the question.
I want to make the formula in Y3 on the "Students" sheet apply to all of the cells below it, much like an array formula does.
Example
After further studying your situation I came with a simple fix based on your original formula. I understand that you want to apply the Y3 formula to the whole table, but without altering its behaviour. I assume that the only moving part would be the students ID (Column A). Then you only need to modify your formula to lock the fixed variables with something like:
=TEXTJOIN(" -- ",TRUE,UNIQUE(QUERY('.data'!$B$2:$F,"SELECT F WHERE B = '"&A3&"'")))
After you write that on Y3 you would need to select it and drag it down to fill the table. Please leave a comment if you need further help.
I am trying to make the following without using google-script.
I have this sheet (A):
And I want to get Sheet (B) "auto-updated", every time the sheet (A) changes.
What I am trying to get on sheet (B):
Thank you very much in advance.
Thanks for sharing a sheet. This formula is in A2 on a new tab called MK.Help.
=ARRAYFORMULA(VLOOKUP(SEQUENCE(COUNTA('sheet 1'!A2:A)*4;1;0)/4+2;{ROW('sheet 1'!A2:A)\'sheet 1'!A2:A\'sheet 1'!B2:E\IF(ROW('sheet 1'!A2:A);'sheet 1'!B1:E1)};MOD(SEQUENCE(COUNTA('sheet 1'!A2:A)*4;1;0);4)*{0\1\1}+{2\3+4\3}))
This solution is designed for 4 columns. In your case, there are no empty cells, but if there were, you would use a query around the solution like this:
=ARRAYFORMULA(QUERY(VLOOKUP(SEQUENCE(COUNTA('sheet 1'!A2:A)*4;1;0)/4+2;{ROW('sheet 1'!A2:A)\'sheet 1'!A2:A\'sheet 1'!B2:E\IF(ROW('sheet 1'!A2:A);'sheet 1'!B1:E1)};MOD(SEQUENCE(COUNTA('sheet 1'!A2:A)*4;1;0);4)*{0\1\1}+{2\3+4\3});"where Col2 is not null"))
It can also be built for an unknown number of columns. If that's something you need, let me know.
I call this a "retabulation" problem and it comes up often enough that i tried to create a lesson for my method. Here's a link to that lesson. It's a bit of a work in progress, but maybe it will help.
https://docs.google.com/spreadsheets/d/1EV_iziWtrTrkPdwY0FI2l0lzTFt-IRQHCOg1punnN5c/edit#gid=0
here the formula:
= arrayformula(
{
"Date","Country","Value";
split
(
transpose
(
split
(
textjoin
(
":",false,filter(A2:A&","&B1:D1&"," & B2:D,A2:A<>"")
)
,":",true,false
)
)
,",",true,false
)
}
)
I have two columns I do the sumproduct operation on them this way:
=SUMPRODUCT(I37:I61, **D37:D61**)
and it works perfectly well - I put the result in the cell I8
but when I copy this function to cell J8
it transfers to:
=SUMPRODUCT(J37:J61, **E37:E61**)
I want TO FIX one array, so my function would look like
=SUMPRODUCT(J37:J61, D37:D61)
I hope it's clear what do I want to achieve :)
are there any ways to do so?
Not sure about google spreadsheet, but in microsoft Excel you would need to use below formula for ur use. I think same will work in Google Spreadsheet too.
=SUMPRODUCT(I37:I61, $D37:$D61)
Notice '$' which says not to translate D when you do copy-paste.
I would used named ranges to avoid any confusion. Here are the steps
1) Select the range D37:D61
2) give the name a range by tying in a name to the left hand side of the fx near where you insert the formula
3) let's call that range DATA1
4) then use the formula =SUMPRODUCT(I37:I61, DATA1)
5) when you copy this formula over to next cells it should show as =SUMPRODUCT(J37:J61, DATA1)
Let me know how you get on.