Excel:如何与范围内的空白单元格相乘?

时间:2019-03-27 20:03:39

标签: excel excel-formula

公式工作正常,但是当我在A1:A3范围内有空单元格时,出现错误:#VALUE!怎么修?原始帖子:Excel: Dynamic formula for change unit size in KB, MB, GB, TB, etc... Automatically

版本:1

=TRUNC(SUMPRODUCT(LEFT(A1:A3,FIND(" ",A1:A3)-1)*10^(MATCH(RIGHT(A1:A3,2),{"KB","MB","GB","TB"},0)*3))/(10^(INT((LEN(SUMPRODUCT(LEFT(A1:A3,FIND(" ",A1:A3)-1)*10^(MATCH(RIGHT(A1:A3,2),{"KB","MB","GB","TB"},0)*3)))-1)/3)*3)),2)&" "&INDEX({"KB","MB","GB","TB"},INT((LEN(SUMPRODUCT(LEFT(A1:A3,FIND(" ",A1:A3)-1)*10^(MATCH(RIGHT(A1:A3,2),{"KB","MB","GB","TB"},0)*3)))-1)/3))

版本:2

=TRUNC(SUMPRODUCT(A1:A4*10^(MATCH(B1:B4,{"KB","MB","GB","TB"},0)*3))/(10^(INT((LEN(SUMPRODUCT(A1:A4*10^(MATCH(B1:B4,{"KB","MB","GB","TB"},0)*3)))-1)/3)*3)),2)&" "&INDEX({"KB","MB","GB","TB"},INT((LEN(SUMPRODUCT(A1:A4*10^(MATCH(B1:B4,{"KB","MB","GB","TB"},0)*3)))-1)/3))

2 个答案:

答案 0 :(得分:0)

我找到了一个很好的指南,对here有帮助。

总结一下:

  

要忽略公式或不计算Excel中特定单元格是否为空白,我们需要使用IF函数检查特定单元格是否为空白,如果不为空白,我们可以继续使用原始公式进行计算

     

=IF(Specific Cell<>"",Original Formula,"")

所以您可以尝试以下方法:

=IF(CELL_TO_CHECK_IF_BLANK<>"",INSERT_FORMULA_HERE,"")

答案 1 :(得分:0)

您将需要添加IFERROR来捕获由于单元格为空而引起的错误。

IFERROR强制我们使用Ctrl-Shift-Enter输入公式并将其设置为数组。由于必须使用数组条目,因此我更改为SUM来保存此庞大公式中的某些输入。

=TRUNC(SUM(IFERROR(LEFT(A1:A3,FIND(" ",A1:A3)-1)*10^(MATCH(RIGHT(A1:A3,2),{"KB","MB","GB","TB"},0)*3),0))/(10^(INT((LEN(SUM(IFERROR(LEFT(A1:A3,FIND(" ",A1:A3)-1)*10^(MATCH(RIGHT(A1:A3,2),{"KB","MB","GB","TB"},0)*3),0)))-1)/3)*3)),2)&" "&INDEX({"KB","MB","GB","TB"},INT((LEN(SUM(IFERROR(LEFT(A1:A3,FIND(" ",A1:A3)-1)*10^(MATCH(RIGHT(A1:A3,2),{"KB","MB","GB","TB"},0)*3),0)))-1)/3))

作为数组公式,需要,退出编辑模式时,请使用Ctrl-Shift-Enter而不是Enter输入公式。

enter image description here