用于计算Google电子表格中项目总和的公式

问题描述

我有连续的项目(项目1,项目2等),并在一列中列出了每个项目的价格,我可以写一个复杂的公式来计算每个项目的总计人,而无需手动输入所有路口?

| Name   | Total   | item 1 | item 2 | item 3 |                 |    |
|--------|---------|--------|--------|--------|-----------------|----|
| John   | 2+9+2=13| 1      | 3      | 2      | price of item 1 | $2 |
| Daniel | 0+6+1=7 | 0      | 2      | 1      | price of item 2 | $3 |
| Max    | 2+3+0=5 | 1      | 1      | 0      | price of item 3 | $1 |

Link to Google Spreadsheet with the example

不幸的是,我不能在这里使用脚本,否则,这将是小菜一碟:(

解决方法

尝试:

=ARRAYFORMULA(IF(A2:A="",MMULT(HLOOKUP(C1:E1,TRANSPOSE(G2:H),2,0)*C2:E,ROW(INDIRECT("A1:A"&COLUMNS(C:E)))^0)))

enter image description here


enter image description here


或更短:

=INDEX(IF(A2:A="",MMULT(1*C2:E,G2:G4)))

enter image description here

,

有关其他解决方案,请尝试:

=ArrayFormula(if(len(A2:A),mmult(--C2:E,G2:G4),))

enter image description here

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...