Array Not populating for column - google-sheets

I'm using the below in google sheets to check whether or not columns have been populated with data. However It's filling Yes for the entire column and I only have sample values in the first row.
=ArrayFormula(if(row(AC:AC)=1,"Has Certificate Been Generated?",ArrayFormula(if(and(AC:AC="",AG:AG="",AK:AK="",AO:AO=""),"No","Yes"))))
Thoughts?
TYIA

You can't use AND() in an ArrayFormula like that. Try something like this instead:
=ArrayFormula(
if(
row(AC:AC)=1,
"Has Certificate Been Generated?",
if((AC:AC="")*(AG:AG="")*(AK:AK="")*(AO:AO=""),
"No",
"Yes"
)
)
)

Related

Google Sheets - Using Countif in an Array Formula - Return Text Value

Picture of Sheet
Hi,
I am trying to use an Array Formula on a Google Form Responses sheet - so the formula needs to be able to populate down for the whole column.
I am trying to count the number of "Yes" per row (max 4) and then if there are 4 return "Yes" (or "No" if there are not). The basic formula would be (and it works):
=if(countif(AA2:AD2, "Yes")=4, "Yes", "No")
However this will not work as an array formula for obvious reasons.
So far I have got the below to work:
=ARRAYFORMULA(if(row(A:A) = 1, "Test One", if(len(A1:A), COUNTIF(if(AA1:AD= "Yes", row(AA1:AA)), row(AA1:AA)),)))
However this returns a number and I still it to return the Yes/No if it is equal to 4 or not.
I have tried to put an if statement in various places to do this however I seem to break it every time.
Does any one please have any suggestions on how to make this work? I have attached a picture if this helps explain it!
Thanks!
When working with array formulas and results row by row, you can consider using BYROW. Try with:
=BYROW(AA2:AD,LAMBDA(each.IF(countif(each, "Yes")=4, "Yes", "No")))
If you want not to have "No" when there are empty rows you can do:
=BYROW(AA2:AD,LAMBDA(each.IF(COUNTA(each)=0,"",IF(countif(each, "Yes")=4, "Yes", "No"))))
This checks if there is any value in those four columns
Or use:
=BYROW(AA2:INDEX(AD:AD,MAX(ROW(A:A),A:A<>"")),LAMBDA(each.IF(countif(each, "Yes")=4, "Yes", "No")))
This limits the BYROW until the last column with values. Change A:A if needed with any column you know that will always be completed by the Form
try:
=INDEX(BYROW((AA2:AD="yes")*1, LAMBDA(x, SUM(x))))
to remove zeros:
=INDEX(BYROW((AA2:AD="yes")*1, LAMBDA(x, IFERROR(1/(1/SUM(x))))))
to return yes/no:
=INDEX(IF(Y2:Y="",,IF(Y2:Y=4, "yes", "no")))

How to return 2 cells using VLOOKUP?

I'm trying to fill the last two columns according to a mapping table, using a VLOOKUP.
However I don't see the last column with Id as expected.
Why?
=VLOOKUP(C10:C,I28:K, {2,3}, FALSE)
I had to add "ArrayFormula"
Is there any way to read which formula requires the `Arrayformula" to expand?
=ARRAYFORMULA(VLOOKUP(C10,I28:K28, {2,3}, FALSE))

Is there a way to create a dynamic Query on Google Sheets?

I'm creating a database on Google Sheets for work and while I'm aware it's not the best solution, due to a number of restraints, that's what I've got to work with atm.
The thing is, I'm creating this for people who don't really know how to work with formulas on Google Sheets so I'm trying to be as user friendly as I can.
I'll use this sample sheet to try and demonstrate what I'm trying to do:
https://docs.google.com/spreadsheets/d/1tXM0IlswQVdwFum9a0pR5NsbtL5Uq_AH1tPbytXGvVg/edit#gid=0
One of the sheets is the Database, which will countain multiple columns of data (there's 10 on the sample, but the actual database is much larger).
There is another sheet called Column Index where I have a list of all columns, what kind of data they represent and a checkbox for people to select what data they want.
Finally, theres a third sheet called Data Extraction and I want to get the checked columns from the Database and send them to this sheet so people can download or copy this data to other worksheet.
It looks like a QUERY situation to me, but I'm not sure if it's possible to do it dynamically
This should do it:
=ArrayFormula(QUERY(
Database!A:K,
"select A,"&
TEXTJOIN(
",",
1,
IFNA(
REGEXEXTRACT(
ADDRESS(
1,
MATCH(
IF(
'Column Index'!C2:C,
'Column Index'!B2:B,
""
),
Database!1:1,
0
)
),
"[A-Z]+"
)
)
)
))
I built the query string, selecting the column indices that we wanted. No need for the "Col Index" Column.
Using Address, we can generate the appropriate column letter using a column address, then we just extract the letters part with a regex.
What I got was not that different as I also tried to construct the query string. The downside is it may be a bit buggy (but it works)
Here it is:
=query(Database!A1:K15,"select A,"&join(",",ArrayFormula(SUBSTITUTE(ADDRESS(1,filter(row('Column Index'!C2:C11),'Column Index'!C2:C11),4), "1", ""))))

Google Sheet one column "fixed, rest tranpose

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
)
}
)

Google Spreadsheet Function That Sums Numbers In A Column When the Row Contains An EXACT Text

I've been at this problem for a while now. I am trying to sum numbers under a specific column when the rows equal a certain text and then display that sum on a different sheet. So far I came up with this formula: =IF(EXACT(A2,Table!A2:A)=TRUE,SUM(Table!C2:C)); however the only problem is that is sums everything in column C (which makes sense).
I wish there was a way to do something like the following: SUM(Table!C2:C where EXACT(A2,TABLE!A2:A)=TRUE). I've also tried the SUMIF(), DSUM(), and QUERY() functions to no avail. I must be getting logically tripped up somewhere.
Figured it out: =SUM(FILTER(Table!E4:E, EXACT(Table!A4:A,A4)=TRUE)).
=sum ( FILTER (b1:b10, a1:a10 = "Text" ) )
// the above formula will help you to take the sum of the values in column B when another column A contain a specific text.
The formula is applicable only in Google Spreadsheets

Resources