PHPExcel Sumif和跳过 [英] PHPExcel Sumif and Skip

查看:104
本文介绍了PHPExcel Sumif和跳过的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只想问一下excel/phpexcel中是否有一个可以求和范围为 单元格,但跳过添加每个单元格.

I just want to ask if there's a function in excel/phpexcel that can SUM a range of cells but skip to add every one cell.

例如范围是A1:G1,每隔1个单元格将只累加A1+C1+E1+G1.

Ex. Range is A1:G1 and it will only sum A1+C1+E1+G1 skipping every 1 cell.

或者我该怎么做?请注意,范围是动态的.可能是a1:g1或更远或更短的

Or how can I do that? Please take note that range is dynamic. It could be a1:g1 or further or less.

推荐答案

在您的PHP脚本中动态构建公式:

Build the formula dynamically in your PHP script:

$startCell = 'A';
$endCell = 'H';
$row = 1;

$formula = '=' . $startCell . $row;
while ($startCell++ != $endCell && $startCell++ != $endCell) {
    $formula .= '+' . $startCell . $row;
}

编辑

请注意,我还为您的上一个问题

这篇关于PHPExcel Sumif和跳过的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆