1

I am working with PhpSpreadsheet(PHPExcel) to do an Excel in PHP and I got stuck when I needed to use COUNTIF. Here is my code:

$spreadsheet->getActiveSheet()->setCellValueByColumnAndRow(59,5,"=COUNTIF(BH7:BH125,'<>0')"); //BH POSITION

It doesn't work. If I putt /* BH7:BH125, 0 */ ,then it works but I want to use <>0. Can anyone help me?

Thanks.

ToniTJK
  • 181
  • 1
  • 3
  • 11

1 Answers1

0

It expects double-quotes for string parameter. Instead

"=COUNTIF(BH7:BH125,'<>0')"

try to use

"=COUNTIF(BH7:BH125,\"<>0\")"
voter
  • 348
  • 1
  • 2
  • 8