Negative Number Formatting

Topics: Developer Forum, User Forum
May 19, 2008 at 4:29 PM
Is it possible to get a negative number to be formatted in red with parenthesis around it? It's a standard number formatting option in Excel.
I can't use conditional formatting because I need to maintain compatibility with Office 2k3.

Thanks!

C.Durbin
Coordinator
May 19, 2008 at 4:50 PM
Try a formatting mask like "[Green]#,##0;[Red](-#,##0)"

e.g.
$this->_objPHPExcel->getActiveSheet()->getStyle($cellID)->getNumberFormat()->setFormatCode("[Green]#,##0;[Red](-#,##0)");
May 19, 2008 at 5:31 PM


MarkBaker wrote:
Try a formatting mask like "[Green]#,##0;[Red](-#,##0)"

e.g.
$this->_objPHPExcel->getActiveSheet()->getStyle($cellID)->getNumberFormat()->setFormatCode("[Green]#,##0;[Red](-#,##0)");


Works perfectly! Thank you!

C.Durbin
May 19, 2008 at 6:09 PM


MarkBaker wrote:
Try a formatting mask like "[Green]#,##0;[Red](-#,##0)"

e.g.
$this->_objPHPExcel->getActiveSheet()->getStyle($cellID)->getNumberFormat()->setFormatCode("[Green]#,##0;[Red](-#,##0)");


Works perfectly! Thank you!

C.Durbin
Nov 8, 2013 at 10:15 PM
work like a charm, thanks :)