Array formula to check for blanks - arrays

I have a google sheet with customer orders.
Column A contains the order number
The next four columns contain various data, filled at various stages of the order. (Columns B through E)
In Column F I'd like to have an array formula that checks when the orders are complete, i.e. each column in a row is filled in, for all rows that contain an order number.
Therefore, if A2:E2 are all filled with data, then in F2 it should state "Complete".
I've tried:
COUNTA
ISBLANK
AND
OR
COUNTBLANK
All formula work on a row by row basis, but not when entered in an arrayformula.
=ArrayFormula(if(and(LEN(A2:A),COUNTA($B2:E)=0)="True","Complete","There be blanks afoot")
Or
=ArrayFormula(If(LEN(A3:A),IF(COUNTBLANK($B2:$E)>0,"Blanks","No Blanks"),""))
Test sheet can be found here:
https://docs.google.com/spreadsheets/d/1mNIGRh910k_q9J2P6mzv9q-h-me3zxbCWeJ2mcaFsXQ/edit?usp=sharing

try:
={"Status"; ARRAYFORMULA(IF(A2:A<>"", IF(MMULT(
IF(B2:E<>"", 1, 0), {1;1;1;1})=4, "Complete", "Still blanks"), ))}

Related

How to make Vlookup index column dynamic?

How could I make VLOOKUP() work somewhat like this?
=VLOOKUP(Z10,Sheet1!A5:Z100,COLUMN(MATCH("ID",Sheet1!A5:5,0)),0)
...where the col index is obtained by matching the column header's with what's entered there.
Thank you!
should be:
=VLOOKUP(Z10, Sheet1!A5:Z100, MATCH("ID", Sheet1!A5:5, 0), 0)
where
=MATCH("ID", Sheet1!A5:5, 0)
match will output the number of column. lets say ID header is in E5. that's 5th column of range A5:5 so the output will be 5, therefore, vlookup will output the 5th column from A5:Z100 which is E column. summary: look for Z10 in A5:Z100 and if Z10 is found in A5:A100 range, output the matching column with header ID

Google Sheets - how can I return participants scores by team, sorted by score?

I have a sheet with participant scores, and each participant is in a team. In a second sheet, I have the following formula to create a subset of participant scores per team in each row.
Here's a link to a sheet with sample data showing my formula:
How can I get the results sorted in decreasing numerical order?
I've tried using the SORT() function (column C in the second sheet), but understandably, it interprets the results as text, so a score of 10 is ranked lowest.
try this superior formula after you delete everything in range A:B:
={"Team", "Scores"; INDEX({UNIQUE(SORT(FILTER(data!B2:B, data!B2:B<>""))),
FLATTEN(SUBSTITUTE(TRIM(QUERY(REGEXREPLACE(SORT(QUERY(
QUERY({data!B2:B, TEXT(data!C2:C, "000000")&CHAR(13)&"("&data!A2:A&")"},
"select min(Col2) where Col1 is not null group by Col2 pivot Col1"),
"offset 1", 0), SEQUENCE(COUNTA(data!A2:A)), 0),
"^0{1,5}", ),,9^9)), " ", CHAR(10)))})}
Just replace 2nd parameter of SORT function with Score.
=if($A:$A="","",arrayformula(textjoin(" ",true,sort(if(Team=A2,Score&" ("&Name&")",""),Score,false))))

How to return "Empty" where a query returns empty cells Google sheets

I have two columns. The first one contains names and the second some numbers. I am perfoming a query on the two columns but some of the cells in the second columns will not contain any value. I need to return "Empty" in those cells but I seem not to be able to with my formula. When I add ISBLANK to the query it throws an error.
My query =query($A$1:$B$20, "select A, B where (B <=80)")
Link to my spreadsheet
https://docs.google.com/spreadsheets/d/12gDxvNONKYxqAPJa6FPGJMXkNv6wlXgHEMNjCg-Iuco/edit?usp=sharing
use:
=ARRAYFORMULA(IF(QUERY(A1:B, "where B <=80 and A is not null")="",
"Empty", QUERY(A1:B, "where B <=80")))
or:
=ARRAYFORMULA(QUERY({A2:A, ""&IF((A2:A<>"")*(B2:B=""), "Empty", B2:B), B2:B},
"select Col1,Col2 where Col2='Empty' or Col3<=80", 0))

Counting rows in a table based on multiple array criterias

I am trying to count rows in a table based on multiple criteria in different columns of that table. The criteria are not directly in the formula though; they are arrays which I would like to refer to (and not list them in the formula directly).
Range table example:
Group Status
a 1
b 4
b 6
c 4
a 6
d 5
d 4
a 2
b 2
d 3
b 2
c 1
c 2
c 1
a 4
b 3
Criteria/arrays example:
group
a
b
status
1
2
3
I am able to do this if i only have one array search through a range (1 column) in that table:
{=SUM(COUNTIFS(data[Group],group[group]))}
Returns "9" as expected (=sum of rows in the group column of the data table which match any values in group[group])
But if I add a second different range and a different array I get an incorrect result:
{=SUM(COUNTIFS(data[Group],group[group], data[Status],status[status]))}
Returns "3" but should return "5" (=sum of rows which have 1, 2 or 3 in the status column and a or b in the group column)
I searched and googled for various ideas related to using sumproduct or defining arrays within the formula instead of classifying the whole formula as an array but I was not able to get expected results via those means.
Thank you for your help.
Because your group and status criteria are a different number of values (2 values for group, but 3 values for status), I'm not sure you can do this in a single formula. Best way I know of to do this would be to use a helper column (which can be hidden if preferred).
Put this array formula in a helper column and copy down the length of your data (array formulas must be confirmed with Ctrl+Shift+Enter):
=AND(OR(data[#Group]=group[group]),OR(data[#Status]=status[status]))
And then get the count with: =COUNTIF(helpercolumn,TRUE)
You could use a slightly different approach, using Power Query / Power Pivot.
Name your tables Data, Group and Status, then create the following query, named Filtered Data:
let
tbData = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
tbGroup = Excel.CurrentWorkbook(){[Name="Group"]}[Content],
tbStatus = Excel.CurrentWorkbook(){[Name="Status"]}[Content],
#"Merged Group" = Table.NestedJoin(tbData,{"Group"},tbGroup,{"Group"},"tbGroup",JoinKind.Inner),
#"Merged Status" = Table.NestedJoin(#"Merged Group",{"Status"},tbStatus,{"Status"},"Merged Status",JoinKind.Inner),
#"Removed Columns" = Table.RemoveColumns(#"Merged Status",{"tbGroup", "Merged Status"}),
#"Changed Type" = Table.TransformColumnTypes(#"Removed Columns",{{"Status", type number}})
in
#"Changed Type"
Load To as connection only, and tick Load to Data Model
Now create a DAX measure:
Status Sum:=SUM ( 'Filtered Data'[Status] )
You can then use the following formula on your worksheet, to get the Sum of Status values, for rows matching the criteria specified in the Group and Status tables:
=CUBEVALUE("ThisWorkbookDataModel","[Measures].[Status Sum]")
Simply refresh the data connection to update the value.

Max If array formula with multiple criteria (no pivot tables)

I'm trying to return the MAX date [G-Step Complete]
for a series of rows with same values [CONCAT],
IF the date column [G-Step Complete] does NOT contain a BLANK. However, if the date column [G-Step Complete] does contain a BLANK, return 0.
This is the array formula I am working with:
=MAX(IF([CONCAT]=[#CONCAT],IF(ISBLANK([G-Step Complete]),0,[G-Step Complete])))
The [CONCAT] column is sorted such that like items are grouped together.
My expectation is that IF any rows for a given group of CONCAT values is blank, then I would expect a result of 0. If NO rows contain a BLANK, then I would expect the value to return the MAX date.
With TB being the name of the table, this should do in Excel 2007 (and above) syntax:
=IF(SUMPRODUCT(([CONCAT]=TB[[#This Row],[CONCAT]])*ISBLANK([G-Step Complete])),0,
LARGE([G-Step Complete]*(([CONCAT] = TB[[#This Row],[CONCAT]])), 1))
could be shortened with the # operator in Excel 2010 and above versions:
=IF(SUMPRODUCT(([CONCAT]=[#CONCAT])*ISBLANK([G-Step Complete])),0,
LARGE([G-Step Complete]*(([CONCAT]=[#CONCAT])), 1))

Resources