Excel::Writer::XLSX 在公式中添加意外的 @(第 2 部分)
Excel::Writer::XLSX adds an unexpected @ in formula (part 2)
这个问题在第一个问题之后:
我正在使用 Excel::Writer::XLSX
将公式写入 xlsx 文件
当我使用 _xlfn
时,当我尝试编写复杂的公式时没有得到预期的结果。这是显示问题的代码:
use Excel::Writer::XLSX;
my $workbook = Excel::Writer::XLSX->new( "test.xlsx" );
my $worksheet = $workbook->add_worksheet();
$worksheet->write( 'B1', "5");
$worksheet->write( 'A1', "4");
$worksheet->write( 'A2', "5");
$worksheet->write( 'A3', "3");
$worksheet->write( 'A4', "4");
$worksheet->write( 'A5', "6");
$worksheet->write( 'A7', "=_xlfn.STDEV.P(IF((A1:A5<B1),A1:A5))");
$workbook ->close();
那么单元格 A7 包含:=STDEV.P(IF((@A1:A5<B1),A1:A5))
并且由于 @
,单元格显示 #NAME?
而不是公式的结果。
有人知道如何删除这个意外的 @
吗?
感谢 JvdV,解决方案确实是使用 {}
use Excel::Writer::XLSX;
my $workbook = Excel::Writer::XLSX->new( "test.xlsx" );
my $worksheet = $workbook->add_worksheet();
$worksheet->write( 'B1', "5");
$worksheet->write( 'A1', "4");
$worksheet->write( 'A2', "5");
$worksheet->write( 'A3', "3");
$worksheet->write( 'A4', "4");
$worksheet->write( 'A5', "6");
$worksheet->write( 'A7', "{=_xlfn.STDEV.P(IF((A1:A5<B1),A1:A5))}");
$workbook ->close();
这个问题在第一个问题之后:
我正在使用 Excel::Writer::XLSX
当我使用 _xlfn
时,当我尝试编写复杂的公式时没有得到预期的结果。这是显示问题的代码:
use Excel::Writer::XLSX;
my $workbook = Excel::Writer::XLSX->new( "test.xlsx" );
my $worksheet = $workbook->add_worksheet();
$worksheet->write( 'B1', "5");
$worksheet->write( 'A1', "4");
$worksheet->write( 'A2', "5");
$worksheet->write( 'A3', "3");
$worksheet->write( 'A4', "4");
$worksheet->write( 'A5', "6");
$worksheet->write( 'A7', "=_xlfn.STDEV.P(IF((A1:A5<B1),A1:A5))");
$workbook ->close();
那么单元格 A7 包含:=STDEV.P(IF((@A1:A5<B1),A1:A5))
并且由于 @
,单元格显示 #NAME?
而不是公式的结果。
有人知道如何删除这个意外的 @
吗?
感谢 JvdV,解决方案确实是使用 {}
use Excel::Writer::XLSX;
my $workbook = Excel::Writer::XLSX->new( "test.xlsx" );
my $worksheet = $workbook->add_worksheet();
$worksheet->write( 'B1', "5");
$worksheet->write( 'A1', "4");
$worksheet->write( 'A2', "5");
$worksheet->write( 'A3', "3");
$worksheet->write( 'A4', "4");
$worksheet->write( 'A5', "6");
$worksheet->write( 'A7', "{=_xlfn.STDEV.P(IF((A1:A5<B1),A1:A5))}");
$workbook ->close();