Google Sheets limit on function - google-sheets

I have formula that I've been using for a while however the formula doesn't work properly anymore.
This is the formula:
=ArrayFormula(INDEX(FILTER(C3:HG3,(C2:HG2="keyword")*(C3:HG3<>"")),1,COUNTIFS(C2:HG2,"keyword",C3:HG3,"<>")))
From time to time I expend the columns and populate them with data.
I started using the formula somewhere from column FX now to column HG and I would like to expend it to column HJ but the formula doesn't work anymore. Is there a limit on calculations on formula's in Google sheets?

try:
=INDEX(INDEX(FILTER(C3:HJ3, (C2:HJ2="keyword")*(C3:HJ3<>"")), 1,
COUNTIFS(C2:HJ2, "keyword", C3:HJ3, "<>")))

Related

Google Sheets - Find the lowest values in the entire table line by line

I can't find a way to make ArrayFormula and SMALL functions work together using the built-in Google sheets functions.
I have a table1 with items and their prices. Each position has the lowest price with SMALL function, but when you add a new row, the formula breaks.
If you roughly add an ArrayFormula (table2), SMALL looks for the lowest value in the entire table, not line by line.
I've tried different combinations of VLOOKUP, ROW, INDEX, but can't solve the puzzle.
Does anyone have any ideas?
try:
=INDEX(TRANSPOSE(QUERY(TRANSPOSE(D14:O);
"select "&TEXTJOIN(","; 1; IF(B14:B="";;
"min(Col"&ROW(B14:B)-ROW(B14)+1&")"))));; 2)
update:
=INDEX(QUERY(SPLIT(FLATTEN(ROW(F14:F)&"×"&OFFSET(F14;;;9^9; 9^9)); "×");
"select min(Col2)
group by Col1
label min(Col2)''"))

Combing base data set for a formula from two *other* Google sheets

We have hit the dreaded 5 million rows limit which is so small for any semi-serious data.
We have an important ArrayFormula piece in one of our worksheets (tab) currently that summarizes the data from another worksheet in the same file where time series data is kept with dates. This is our current function:
=ArrayFormula(SUMIFS(DataSheet!$B:$B,
MONTH(DataSheet!$A:$A), 1,
YEAR(DataSheet!$A:$A), 2020)
)
Explanation: This basically summed all of column B in the DataSheet tab for the month of Jan 2020 based on date found in column A of that sheet.
However, this worksheet of data that is now running close to that row limit. We can move it to another Google Sheets file, and refer to the same data via IMPORTRANGE.
The question then is how to refer to that data instead of the DataSheet!$A:$A in the above old formula? Will this reference be replaced by the entire IMPORTRANGE function?
Old:
=ArrayFormula(SUMIFS(DataSheet!$B:$B,
MONTH(DataSheet!$A:$A), 1,
YEAR(DataSheet!$A:$A), 2020)
)
New:
=ArrayFormula(SUMIFS(IMPORTRANGE(filename, rows)!$B:$B,
MONTH(IMPORTRANGE(filename, rows)!$A:$A, 1,
YEAR(IMPORTRANGE(filename, rows)!$A:$A, 2020)
)
This does not work of course, because we cannot have the exclamation ! followed by the column in an importrange. Any other thoughts?
Try this in cell A1 on a fresh, brand new tab somewhere:
=ARRAYFORMULA(QUERY(1*TEXT(IMPORTRANGE("[spreadsheet key]","Sheet1!A:B"),{"mmmyyyy","0.00"}),"select Col1,SUM(Col2) where Col2<>0 group by Col1 order by Col1")
The "spreadsheet key" is the combination of letters and numbers after the "/d/" and before the "/edit..." in the URL of your source sheet.
Obviously, you'd also replace "Sheet1!A:B" with whatever the real tab/column reference is.
Then, select all of Column A and from the Menu choose Format>Number>More Formats>Custom Number Formatting, Then this in the dialog box:
mmmm yyyy
You want to IMPORTRANGE from two different sheets in a different spreadsheet.
While the following formula will import data from both sheets, it will also import the blank rows, so you might have to scroll down hundreds of rows in order to see the data from the second sheet (and this might give your the wrong impression that the second sheet is not getting imported):
{
IMPORTRANGE("SPREADSHEET_ID","CurrentMonth!$A:$J");
IMPORTRANGE("SPREADSHEET_ID","All2020!$A:$J")
}
You can use QUERY in order to filter out blank rows:
=QUERY(
{
IMPORTRANGE("SPREADSHEET_ID","CurrentMonth!$A:$J");
IMPORTRANGE("SPREADSHEET_ID","All2020!$A:$J")
},
"SELECT * WHERE Col1 IS NOT NULL ORDER BY Col1 DESC"
)
Note:
I thought you'd like to sort the data according to the date in column A, please remove ORDER BY Col1 DESC if that's not the case.

Using ArrayFormula to countif multiple columns and output the sum on each row

I've created a dense formula using COUNTIF and VLOOKUP across multiple columns, and I've currently set it up so that I have to copy/paste every formula. But I'd really like to be able to use arrayformula to write the formula once for each of the columns below, and have it render across at least 1000 rows. Is there a trick to writing this?
Column 1
=COUNTIF(VLOOKUP(F3,WarLinesValuesTypes,2,FALSE),"*Defense*")
+COUNTIF(VLOOKUP(G3,WarLinesValuesTypes,2,FALSE),"*Defense*")
+COUNTIF(VLOOKUP(H3,WarLinesValuesTypes,2,FALSE),"*Defense*")
+COUNTIF(VLOOKUP(I3,WarLinesValuesTypes,2,FALSE),"*Defense*")
+COUNTIF(VLOOKUP(J3,WarLinesValuesTypes,2,FALSE),"*Defense*")
Column 2
=COUNTIF(VLOOKUP(F3,WarLinesValuesTypes,2,FALSE),"*Offense*")
+COUNTIF(VLOOKUP(G3,WarLinesValuesTypes,2,FALSE),"*Offense*")
+COUNTIF(VLOOKUP(H3,WarLinesValuesTypes,2,FALSE),"*Offense*")
+COUNTIF(VLOOKUP(I3,WarLinesValuesTypes,2,FALSE),"*Offense*")
+COUNTIF(VLOOKUP(J3,WarLinesValuesTypes,2,FALSE),"*Offense*")
I also saw the StackOverflow post here (iterate row by row COUNTIF using ArrayFormula on Google Sheets), and tried to emulate it, but I am not getting it right. My sheet (https://docs.google.com/spreadsheets/d/1JR_eYvmf6YgW0CfzHrSR6dxF8RmyWhSKhqSpRnnbipk/edit?usp=sharing) shows the complex formula working correctly for both columns, as well as my failed attempt for 1 of those columns as a trial using arrayformula, mmult, and sign.
try:
=ARRAYFORMULA(MMULT(IF(REGEXMATCH(IFNA(VLOOKUP(
INDIRECT("F2:J"&COUNTA(B2:B)+1), 'Flattened Standard War Lines'!A:B, 2, 0)),
".*Offense.*"), 1, 0), TRANSPOSE(COLUMN(F:J))^0))

Google Sheets ARRAYFORMULA and SUMIF combination

I recently noticed a mistake in my calculation, and I've identified the root cause of the problem: it seems that I mistakenly used the SUMIF function in Google Sheets' ARRAYFORMULA.
I have the sample spreadsheet here.
I wrote the ARRAYFORMULA function that results in column C, which I thought would be the same with the formula in column B.
The formula in column C:
=ARRAYFORMULA(SUMIF(H$3:H$6&I$3:I$6,"<="&A3:A31&">="&A3:A31,G$3:G$6))
The formula in column B:
=SUMIFS(G$3:G$6,H$3:H$6,"<="&A3,I$3:I$6,">="&A3)
In essence, I want to get the value for each date based on predefined values with their own periods.
Please, use this formula in the cell C3:
=ARRAYFORMULA(MMULT(IF((A3:A31>=TRANSPOSE(H3:H5))*
(A3:A31<=TRANSPOSE(I3:I5))=1,TRANSPOSE(G3:G5),0),ROW(G3:G5)^0))
I made a new tab called MK.Help and erased all the other formulas. then i put this formula in C3:
=ARRAYFORMULA(ARRAY_CONSTRAIN(MMULT(N(A3:A>=TRANSPOSE(A3:A)),MMULT((A3:A>=TRANSPOSE(H3:H))*(A3:A<=TRANSPOSE(I3:I)),N(G3:G))),COUNTA(A3:A),1))
Does that work for you?

How to use Sumif using range from a complete different Googlesheet/doc

I know how sumif works when I need to access it within the same Google "workbook" (using the analogy from excel). By workbook I mean a collection of sheets, not sure whether there is a different way to refer to Google workbook.
For example in the sheet (Example 3): https://docs.google.com/spreadsheets/d/1Dm-N-1X38zHartE3JbPUtWDnYwEpkGHl6v06huvjSa8/edit#gid=0
I have Sheet2, with column A contain strings and column B containing numerical value. On sheet 1, I have a sumif function which can be query data stored in Sheet2, and sum the cells which match A1 in Sheet1.
The problem starts happening when I try to refer to ranges in a completely different workbook, which is shown below.
I am trying to do a sumif over 2 ranges from a different "workbook". The data is stored here (Example 2): https://docs.google.com/spreadsheets/d/1P5Inf09fLSRmsGbG7LwlE4V-r7DzqY0SB5tJuMKMZH0/edit#gid=0
The Sumif function is in Cell B1 of the following sheet (Example 1):https://docs.google.com/spreadsheets/d/1AitilELd6w7Dbv9d-mKhBYGTBaO6DdkU29Y5mofX2TI/edit#gid=0.
From my understanding importrange is typically used to refer to ranges in completely different workbooks, as a result I use importrange as the first and last arguments in the sumif function in the Sheet Example 1.
What am I doing wrong? Why is this not working?
Can anybody help?
Thanks a lot
See if this query does what you want:
=SUM(query( QUERY( Importrange("1P5Inf09fLSRmsGbG7LwlE4V-r7DzqY0SB5tJuMKMZH0","Sheet1!A1:B10") ) , "select Col2 where Col1 contains '"&A1&"'" ) )

Resources