PHPExcel Sumif and Skip

后端 未结 1 904
甜味超标
甜味超标 2021-01-16 21:18

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.

Ex. Range is A1:G1

1条回答
  •  情歌与酒
    2021-01-16 21:58

    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;
    }
    

    EDIT

    Note that I've also added a pure Excel formula answer to your previous question

    0 讨论(0)
提交回复
热议问题