使用PHP中的number_format()函数在phpexcel中设置逗号分隔数

I am generating Excel using PHPExcel.

All code working fine. But comma separated number with number_format() function is not working properly.

When i use below code it is working properly.

$val=round($data);
$objPHPExcel->getActiveSheet()->SetCellValue('J'.$rowCount,$val);
$objPHPExcel->getActiveSheet()->getStyle('J'.$rowCount)->getNumberFormat()->setFormatCode("#,##0");

But when i use

$val=number_format($data);

I am not getting proper output. In excel ,cell value is proper (6,000) but input line it displayed

'6,000

So can't do autosum.

I don't want to use round() function, because i am generating pdf ,csv also and i have common function to get values.

Thanks