Filtering an Array (not Range) based on a SUM of CHOOSECOLS applied to it

I have a series of cells with variations of a long formula which involves filters.

It takes a certain array, does some counting to some of its columns (checking the number of nonempty cells, then the number of positive cells), but then I need to filter that array further based on the sum of certain of its columns. The important nuance is that I need this formula to be pretty uniform, only changing the first two variables (label and countedColumns) for ease of mass implementation. This seemed to work great until I had to reference the proper cells inside the row for the sake of filtering, and to sum the values of those cells.

So far I tried something roughly like this (failing at the filtering stage):

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>=LET(
label, " SomeLabel ",
countedColumns, {30,33},
array, IF(ArrayOfTheDay!$A$3:$ZZ$999="","",ArrayOfTheDay!$A$3:$ZZ$999),
countedCells, CHOOSECOLS(array, countedColumns),
countedCellsClean, IF(countedCells="","",countedCells),
attemptCount, SUMPRODUCT(--(countedCellsClean<>"")),
successCount, SUM(countedCellsClean),
filteredSuccessData, FILTER(array, SUM(CHOOSECOLS(array,countedColumns)>0)), // this is not working
listOfSuccessDataAsText, // this will TextJoin/Concatenate certain cells from List
successCountText, IF(successCount>0, successCount&": ", "-"),
attemptCountText, IF(attemptsCount>0, " attempts: "&attemptCount, ""),
CONCATENATE(label, successCountText, ": ", listOfSuccessDataAsText," separator ", attemptCountText)
)
</code>
<code>=LET( label, " SomeLabel ", countedColumns, {30,33}, array, IF(ArrayOfTheDay!$A$3:$ZZ$999="","",ArrayOfTheDay!$A$3:$ZZ$999), countedCells, CHOOSECOLS(array, countedColumns), countedCellsClean, IF(countedCells="","",countedCells), attemptCount, SUMPRODUCT(--(countedCellsClean<>"")), successCount, SUM(countedCellsClean), filteredSuccessData, FILTER(array, SUM(CHOOSECOLS(array,countedColumns)>0)), // this is not working listOfSuccessDataAsText, // this will TextJoin/Concatenate certain cells from List successCountText, IF(successCount>0, successCount&": ", "-"), attemptCountText, IF(attemptsCount>0, " attempts: "&attemptCount, ""), CONCATENATE(label, successCountText, ": ", listOfSuccessDataAsText," separator ", attemptCountText) ) </code>
=LET(
label, " SomeLabel ",
countedColumns, {30,33},

array, IF(ArrayOfTheDay!$A$3:$ZZ$999="","",ArrayOfTheDay!$A$3:$ZZ$999),

countedCells, CHOOSECOLS(array, countedColumns),
countedCellsClean, IF(countedCells="","",countedCells),
attemptCount, SUMPRODUCT(--(countedCellsClean<>"")),
successCount, SUM(countedCellsClean),

filteredSuccessData, FILTER(array, SUM(CHOOSECOLS(array,countedColumns)>0)), // this is not working
listOfSuccessDataAsText, // this will TextJoin/Concatenate certain cells from List

successCountText, IF(successCount>0, successCount&": ", "-"),
attemptCountText, IF(attemptsCount>0, " attempts: "&attemptCount, ""),
CONCATENATE(label, successCountText, ": ", listOfSuccessDataAsText," separator ", attemptCountText)
)

How can I properly choose the right columns within a row for the sake of filtering rows based on their sums, or how else can I approach it so as to not need to specify the columns multiple times per such formula? (I.e. I would rather not have to manually write a bunch of (column1address>0)+(column2address>0)+() entries in each and every instance of this filter, and it would be best not to use addresses at all.)

4

The second argument of FILTER expects an array with the same number of rows as the first argument. However, SUM returns a single scalar value, not an array.

If you want to turn multiple columns into a single column containing their sum, then use the MMULT function

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>summedColumn, MMULT(countedCells,--TRANSPOSE(INDEX(countedCells,1,)=INDEX(countedCells,1,))),
filteredSuccessData, FILTER(array, summedColumn>0)
</code>
<code>summedColumn, MMULT(countedCells,--TRANSPOSE(INDEX(countedCells,1,)=INDEX(countedCells,1,))), filteredSuccessData, FILTER(array, summedColumn>0) </code>
summedColumn, MMULT(countedCells,--TRANSPOSE(INDEX(countedCells,1,)=INDEX(countedCells,1,))), 

filteredSuccessData, FILTER(array, summedColumn>0)

or the ByRow function:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>summedColumn, ByRow(countedCells, LAMBDA(rw, SUM(rw))),
filteredSuccessData, FILTER(array, summedColumn>0)
</code>
<code>summedColumn, ByRow(countedCells, LAMBDA(rw, SUM(rw))), filteredSuccessData, FILTER(array, summedColumn>0) </code>
summedColumn, ByRow(countedCells, LAMBDA(rw, SUM(rw))), 

filteredSuccessData, FILTER(array, summedColumn>0)

2

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>FILTER(array,SUM(CHOOSECOLS(array,countedColumns)>0))
</code>
<code>FILTER(array,SUM(CHOOSECOLS(array,countedColumns)>0)) </code>
FILTER(array,SUM(CHOOSECOLS(array,countedColumns)>0))

The FILTER function requires the second argument to be an array of the same height as the first argument but SUM produces a sing value only.

Guessing you want to compare the sum of column1 and column2 with a given number in each row, your formula should look like:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>FILTER(array,CHOOSECOLS(array,30)+CHOOSECOLS(array,33)>0)
</code>
<code>FILTER(array,CHOOSECOLS(array,30)+CHOOSECOLS(array,33)>0) </code>
FILTER(array,CHOOSECOLS(array,30)+CHOOSECOLS(array,33)>0)

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật