【发布时间】:2020-07-05 02:13:42
【问题描述】:
我一直在创建几个公式并将它们添加到 PhpSpreadsheet 中,没有任何问题。但是当我创建以下公式时,添加到 PhpSpreadsheet 并打开 xlsx 文件 8 行中有 6 行有 '#VALUE!'
该公式正在计算大于或等于最小值且小于或等于最大值的单元格范围的 STDEV。
公式是这样创建的:
$cf_mP_Stdev =
"=STDEV(IF(('" . $samplesWellsSheetName . "'!" . $mpCol . ($writeSampleWellsRow - 319) . ":" . $mpCol . $writeSampleWellsRow . ">=J" . $writeControlPlatesRow . ")*('" .
$samplesWellsSheetName . "'!" . $mpCol . ($writeSampleWellsRow - 319) . ":" . $mpCol . $writeSampleWellsRow . "<=L" . $writeControlPlatesRow . "),'" .
$samplesWellsSheetName . "'!" . $mpCol . ($writeSampleWellsRow - 319) . ":" . $mpCol . $writeSampleWellsRow . "))";
我期待在 Excel 中:
=STDEV(IF(('Samples-Wells'!H3:H322>=J4)*('Samples-Wells'!H3:H322<=L4),'Samples-Wells'!H3:H322))
但是当我打开我的 xlsx 文件时,它在三个范围中的两个前面有“@”符号:
=STDEV(IF((@'Samples-Wells'!H3:H322>=J4)*(@'Samples-Wells'!H3:H322<=L4),'Samples-Wells'!H3:H322))
对于这个公式和下一个公式,计算值是正确的。但是对于接下来的 6 个公式,我收到了“#VALUE!”。这是第三个公式。没有区别,只是它针对的是下一组单元格。 Samples-Wells 工作表中的 H 列包含第 3 行到第 1282 行的数据。
=STDEV(IF((@'Samples-Wells'!H323:H642 >= J6)*(@'Samples-Wells'!H323:H642 <= L6),'Samples-Wells'!H323:H642))
所以我的问题是:
-
为什么要在公式中添加 @ 符号?这是来自 PhpSpreadsheet 还是 Excel?
旁注:如果我从 Excel 的公式中手动删除 @ 符号并按 Enter,则计算是正确的。
关于为什么“Stdev mP”的前两个公式有效,但后六个失败的任何想法?
使用 PhpSpreadsheet 1.10.1
【问题讨论】:
标签: php phpspreadsheet