最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

google sheets - Arrayformula with sumifs and 1 static criteria - Stack Overflow

programmeradmin1浏览0评论
Date       PRDEF55FA9E  PRDDCACBC41 PRDFEC1A0E8
2025-03-12     0            0           0
2025-03-11  20740         22740       8680
2025-03-10  17620         12060       4200
2025-03-08  16380         15580       9880

Desired outcome: I have a table StockSoldDetails with the raw data that I would like to summarize as above. For example, C2 is the sum in StockSoldDetails of Quantity where the Date is B2 and the ProductID is C1.

The row headers (Colummn DATE) are dynamically added from a tab named AgentWorkDays:

=UNIQUE(QUERY({AgentWorkDays!$M$2:$M}, " SELECT Col1 WHERE Col1 IS NOT NULL ORDER BY Col1 ASC LABEL Col1 'Date' ", 0))

The Column headers are dynamically added from a tab named Products:

=TRANSPOSE(QUERY(Products!A2:I9, "SELECT Col1 WHERE Col9='Yes'"))

In the desired outcome table, I have to manually insert the formula in each cell; for example in C2:

=(IF(NOT(ISBLANK($B$2:$B)), SUMIFS(StockSoldDetails!$D$2:$D, StockSoldDetails!$J$2:$J, $B$2:$B, StockSoldDetails!$C$2:$C, C$1 ), ""))

My goal: I would like to fill the content of the table dynamically using ARRAYFORMULA so that each time a new row is added the table content is calculated and populated.

What I've tried: I wrapped the formula in C2 in a ARRAYFORMULA() and it only works 50%. It doess generate a new line each time a new date is created but the value on each line is always the same result from the date in B2, see screenshot below:

The formula in C2 to populate column C2:C is:

=ARRAYFORMULA(IF(NOT(ISBLANK($B$2:$B)), SUMIFS(StockSoldDetails!$D$2:$D, StockSoldDetails!$J$2:$J, $B$2:$B, StockSoldDetails!$C$2:$C, C$1 ), ""))

I believe the issue is that the criteria C$1 does not meet the format for ARRAYFORMULA. How can I fix this?

Date       PRDEF55FA9E  PRDDCACBC41 PRDFEC1A0E8
2025-03-12     0            0           0
2025-03-11  20740         22740       8680
2025-03-10  17620         12060       4200
2025-03-08  16380         15580       9880

Desired outcome: I have a table StockSoldDetails with the raw data that I would like to summarize as above. For example, C2 is the sum in StockSoldDetails of Quantity where the Date is B2 and the ProductID is C1.

The row headers (Colummn DATE) are dynamically added from a tab named AgentWorkDays:

=UNIQUE(QUERY({AgentWorkDays!$M$2:$M}, " SELECT Col1 WHERE Col1 IS NOT NULL ORDER BY Col1 ASC LABEL Col1 'Date' ", 0))

The Column headers are dynamically added from a tab named Products:

=TRANSPOSE(QUERY(Products!A2:I9, "SELECT Col1 WHERE Col9='Yes'"))

In the desired outcome table, I have to manually insert the formula in each cell; for example in C2:

=(IF(NOT(ISBLANK($B$2:$B)), SUMIFS(StockSoldDetails!$D$2:$D, StockSoldDetails!$J$2:$J, $B$2:$B, StockSoldDetails!$C$2:$C, C$1 ), ""))

My goal: I would like to fill the content of the table dynamically using ARRAYFORMULA so that each time a new row is added the table content is calculated and populated.

What I've tried: I wrapped the formula in C2 in a ARRAYFORMULA() and it only works 50%. It doess generate a new line each time a new date is created but the value on each line is always the same result from the date in B2, see screenshot below:

The formula in C2 to populate column C2:C is:

=ARRAYFORMULA(IF(NOT(ISBLANK($B$2:$B)), SUMIFS(StockSoldDetails!$D$2:$D, StockSoldDetails!$J$2:$J, $B$2:$B, StockSoldDetails!$C$2:$C, C$1 ), ""))

I believe the issue is that the criteria C$1 does not meet the format for ARRAYFORMULA. How can I fix this?

Share Improve this question edited Mar 12 at 13:21 TheMaster 51.3k7 gold badges73 silver badges100 bronze badges asked Mar 12 at 9:59 user544849user544849 93 bronze badges 1
  • 1 Make sure to provide input and expected output as plain text table in the question. Check my answer or other options to create a table easily, which are easy to copy/paste. Avoid sharing links like spreadsheets, which make the question useless for others or images, which are hard to copy. Also, note that your email address can also be accessed by the public, if you share Google files. – TheMaster Commented Mar 12 at 10:07
Add a comment  | 

1 Answer 1

Reset to default 1

Try

=ARRAYFORMULA(IF(B2:B="", , SUMIF(StockSoldDetails!J2:J & StockSoldDetails!C2:C, B2:B & C1, StockSoldDetails!D2:D))) 
发布评论

评论列表(0)

  1. 暂无评论