Create yet another sheet, with a catchy name like for example PRINTING.
Use the FILTER
formula to set the data range and filter for the sub-contractor:
=FILTER(DATA!A:U, DATA!F:F=H1) // H1 = Xzila
If you place H1
outside the printing area, then it will not take part in the printing.
Short answer
The desired result could be obtained without scripting and this is recommended for cases where number of cells is small, especially if the OP don't know about scripting. To do so,
- Add auxiliary columns for each sorting criteria
- Then use the SORT() or QUERY() functions.
Extended answer
Google Sheets has some additional functions regarding those available in other spreadsheet applications. Two of them are SORT() and QUERY() which allow to get the desired result without scripting.
As QUERY() return a blank cell for those containing ?
as value, the SORT() function will be used.
Original data
Assume that the original data is in A2:D13
.
Auxiliary columns
Auxiliary columns will be used for sorting. Only one aggregate function is presented in order to keep the answer short.
Add the following formulas and fill down until the last row of the source data.
D2: =Row(C2)-Row($C$2)+1
E2: =ISERROR(LOOKUP("?",OFFSET($A$2,MATCH(A2,$A$2:$A$13,0)-1,2,COUNTIF($A$2:$A$13,A2))))
F2: =AVERAGEIF($A$2:$A$13,A2,$C$2:$C$13)
If you find helpful having column headers, add them to the row 1.
Key Formula
G2: =ARRAY_CONSTRAIN(SORT(A2:F13,5,TRUE(),6,TRUE(),1,TRUE()),12,3)
ARRAY_CONSTRAIN
is included to limit the result to the columns of the source data.
Best Answer
You can use an array like this :
It will return an array like this :
You are just limited by the number of column, every range must have the same number of columns.
For a single row it's the same deal except you need to replace
;
with,
:It returns :