【问题标题】:Remove "#DIV/0!" for average and standard deviation calculation删除“#DIV/0!”用于平均和标准偏差计算
【发布时间】:2015-10-10 14:16:39
【问题描述】:

我计算同一列中一系列行中的值的平均值和标准偏差,但是当列中没有输入值时,例如,我得到“#DIV/0!”在应该出现平均值或标准差的单元格中,那么我该如何解决这个问题,以便我得到消息“未计算”而不是“#DIV/0!”。

这是我在单元格中输入平均公式的方法:

newWorkBook.Worksheets("Feuil1").Range(Cells(29, i + 2).Address()).Formula = "=AVERAGE(" + Cells(19, i + 2).Address() + ":" + Cells(28, i + 2).Address() + ")"

编辑:我试过这个:

newWorkBook.Worksheets("Feuil1").Range(Cells(29, i + 2).Address()).Formula = "=IFERROR(AVERAGE(" + Cells(19, i + 2).Address() + ":" + Cells(28, i + 2).Address() + ")" + "," + "non calculated" + ")"

然后我得到“#NOM?”而不是“非计算”(PS:我使用的是法语版本的 Excel,所以英文可能是“#NAME?”)

【问题讨论】:

  • newWorkBook.Worksheets("Feuil1").Range(Cells(29, i + 2).Address()).Formula = "=IFERROR(AVERAGE(" & Cells(19, i + 2) ).Address() & ":" & Cells(28, i & 2).Address() & ")" & "," & "non computed" & ")" 使用 "&"'s not "+"' s

标签: vba excel


【解决方案1】:

在您当前的公式周围添加=IFERROR(AVERAGE(...), """" & "non calculated" & """")

要将引用文字注入源代码,您需要编写""""

【讨论】:

  • 对不起。将“未计算”替换为“”“”和“未计算”和“”“”。您需要在公式中使用字符串文字,
  • 它现在可以工作了,谢谢,请使用此附加信息编辑您的答案,以便这篇文章的未来读者清楚地看到它
猜你喜欢
  • 1970-01-01
  • 2014-03-21
  • 2020-09-01
  • 2021-11-04
  • 2019-12-11
  • 1970-01-01
  • 2012-02-17
相关资源
最近更新 更多