I have a Google Spreadsheet where I have maintained the results of some students. I need to display the number of students passed or failed per class from the filtered rows only. I am trying to obtain the same by using the following function:
=SUMPRODUCT(SUBTOTAL(3,OFFSET($B$2:$B$9,ROW($B$2:$B$9)-MIN(ROW($B$2:$B$9)),,1)),($C$2:$C$9=G$4)*($D$2:$D$9="PASS"))
The above function works fine if the spreadsheet is downloaded and opened in Excel. But in Google Spreadsheet, it returns the following error:
SUMPRODUCT has mismatched range sizes. Expected row count: 1, column count: 1. Actual row count: 8, column count: 1.
Can anyone help me with a fix?
Link to the Google Spreadsheet
Use the following formula in F4:
=QUERY(
{C2:D,ARRAYFORMULA(COUNTIFS(C2:C,C2:C,D2:D,D2:D))},
"select Col2, max(Col3) where Col3 > 0 group by Col2 pivot Col1 order by Col2 desc")
The resulting table will dynamically expand as you add more classes and test results to the data table.
Link to Google Sheet
Related
How can I combine 2 spreadsheets into one without any gaps? When I import range 2 sheets, there is a gap of ~1000 rows. To make sure there are no gaps between the 2 sheets, I usually create a query "Where Col1 is not null " but I am missing some info. :(
My spreadsheet: https://docs.google.com/spreadsheets/d/1aSnbySwNPEvkkXqw6ItuBpZ_6-o58HPlVicIHWD0Y4I/edit#gid=381064131
Thanks in advance.
You can use just being three columns:
=query({
importrange("https://docs.google.com/spreadsheets/d/1aSnbySwNPEvkkXqw6ItuBpZ_6-o58HPlVicIHWD0Y4I/edit#gid=0", "Sheet1!A2:C");
IMPORTRANGE("https://docs.google.com/spreadsheets/d/1aSnbySwNPEvkkXqw6ItuBpZ_6-o58HPlVicIHWD0Y4I/edit#gid=0", "Sheet2!A2:C")}, "Select * WHERE Col1 IS NOT NULL OR Col2 is not null OR Col3 is not null")
A second possible scenario for avoiding empty rows, no matter how many columns you have is wrapping your range or query in LAMBDA, and use FILTER associated with BYROW and COUNTA. If there are no elements in any row, then the count will be 0 and it will be filtered out:
=LAMBDA(quer,FILTER(quer, BYROW (quer, LAMBDA (each,COUNTA(each)))))({
importrange("https://docs.google.com/spreadsheets/d/1aSnbySwNPEvkkXqw6ItuBpZ_6-o58HPlVicIHWD0Y4I/edit#gid=0", "Sheet1!A2:C");
IMPORTRANGE("https://docs.google.com/spreadsheets/d/1aSnbySwNPEvkkXqw6ItuBpZ_6-o58HPlVicIHWD0Y4I/edit#gid=0", "Sheet2!A2:C")})
Both solutions return:
Right now I am using this query to search for a row based on its Column 1 value. Then it takes the value from the last column. I need a way for it to automatically find the last column in the row since some of the rows have more columns than others.
This is what I had before, which I had manually specified the last column with a value:
=QUERY(IMPORTRANGE("link_redacted","PriceList!A1:AZ100000"), "Select Col10 where Col1 = '5531001'",1)
I have tried using LOOKUP with ARRAYFORMULA I couldn't get it to work:
=QUERY(IMPORTRANGE("link_redacted","PriceList!A1:AZ100000"), "Select (LOOKUP(1, ARRAYFORMULA(1/[Select Col1 where Col1 = '5531006']:[Select Col100 where Col1 = '5531006']<>"")[Select Col1 where Col1 = '5531006']:[Select Col100 where Col1 = '5531006']))",1)
Any ideas for a simpler way to do this?
Since no example is presented, I tested the formulas given but no source data is fetched.
so i created a a minimal, reproducible example
Example is the data on the left
Use this formula to get the last non empty columns values.
=ArrayFormula(IFERROR( REGEXEXTRACT( TRIM(TRANSPOSE(QUERY(TRANSPOSE(C3:E),,ROW(C3:E)))), "[^\s]+$")))
I'm trying to convert my Sumifs formula into an array formula
(so that the sheet auto updates)
I'm struggling to do so though
I tried using sumif formula and combining the columns, but I can't get it to work right.
I created this simplified version of my data
https://docs.google.com/spreadsheets/d/1qnoY_MZTup8XLLWCu61-Ifiv8dak6QRc1CxsGKpmFWE/edit?usp=sharing
(I know there's only two rows, but in my actual data there's a lot more and the number of brands vary)
I've shown in column C on sheet 2 how the sumifs formula works.
But ideally I'd like an array formula in cell B2 that will populate all the rows for me (instead of having to fill down the sumifs each time)
No need to use arrayformula for this. You can simply use query:
Formula (A2):
=query({Sheet1!A2:D}, "select Col1, sum(Col4) where Col1 is not null and Col2 is null and Col3 is null group by Col1 label sum(Col4) ''")
This will populate both A and B.
Output:
I have some simple data in the following format:
I need to make a sum of the last column, but based on the text in Domain column. The resulting table should be like this...given the text filtering needed, I'm not using pivot tables.
To do this, for July Domain 1 for example, I have a formula like this:
=SUMIFS(C:C, MONTH(A:A), 7, B:B, "domain1.")
And for the rest of the domains:
=SUMIFS(C:C, MONTH(A:A), 7, B:B, "<>domain1.")
I am using SUMIFS because I need the multiple conditionals. But this formula above gives an error:
Error: Array arguments to SUMIFS are of different size.
The columns are all structured as A:A, B:B, etc. What is going wrong?
Thanks.
MONTH(A:A)
will output only one cell unless you wrap your formula into INDEX or ARRAYFORMULA:
=INDEX(SUMIFS(C:C, MONTH(A:A), 7, B:B, "<>domain1.*"))
=ARRAYFORMULA(QUERY({TEXT(A2:A, "mmmm"), B2:C},
"select Col1,sum(Col3)
where not Col2 contains 'domain1.'
and Col3 is not null
group by Col1
label sum(Col3)''"))
I have a spreadsheet with 2 sheets in it, I want to summarize the weekly results by date. I'm trying to use the query sum function to summarize everything since I wasn't able to do it with arrayformula.
but I'm not able to do it with a query as well. I don't want to just copy-paste the sum function from each row to the next I want to just type the date I need in column A and get all the results in the different columns.
https://docs.google.com/spreadsheets/d/1ZsKXw32ycO_5KGD2I-Ug_GmqSIB_Z-D3Z1jlGd6fpTE/edit?usp=sharing
link to sheets.
getting the data from the database sheet. I want to display the data-oriented by date and summed.
=ArrayFormula(IFERROR(FILTER(QUERY(DataBase!A2:E,"select A,sum(E)
where A is not null
group by A
label sum(E)''"), WEEKNUM(DataBase!A2:A)=WEEKNUM(A2:A))
))
I tried this formula and it dosent work..
=ARRAYFORMULA(IFERROR(VLOOKUP(A2:A,
QUERY(FILTER(DataBase!A2:E,WEEKNUM(DataBase!A2:A)=WEEKNUM(A2)),
"select Col1,sum(Col5)
where Col1 is not null
group by Col1
label sum(Col5)''"), 2, 0)))