admin管理员组

文章数量:1307716

I have an arbitrary number of columns with values I'd like to sum if there is a date in A

Essentially, SUM C2:2 if A2 is not null

date Total col1 col2
03/02/2025 ? 15 234
02/02/2025 5 22
01/02/2025 23 3
31/01/2025 234

I have an arbitrary number of columns with values I'd like to sum if there is a date in A

Essentially, SUM C2:2 if A2 is not null

date Total col1 col2
03/02/2025 ? 15 234
02/02/2025 5 22
01/02/2025 23 3
31/01/2025 234

I have tried

=ARRAYFORMULA(IF(A2 = "", "", SUM(C2:2)))

However it doesn't loop down to the end of the dates

Share Improve this question edited Feb 6 at 12:15 Patsytalk 1,1171 gold badge1 silver badge15 bronze badges asked Feb 3 at 9:38 David AlshDavid Alsh 7,6858 gold badges43 silver badges79 bronze badges 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 Feb 3 at 10:02
Add a comment  | 

2 Answers 2

Reset to default 1

You may try:

=byrow(indirect("C2:"&rows(A:A)),lambda(Σ,if(index(A:A,row(Σ))="",,sum(Σ))))

You may try the following formula-

=MAP(A2:A,LAMBDA(x,IF(x="",,SUM(INDIRECT("C"&ROW(x)&":"&row(x))))))

本文标签: google sheetsUsing arrayformula to sum row if column is not emptyStack Overflow