#VALUE! error in PHP/EXCEL

Topics: Developer Forum
Dec 18, 2013 at 3:31 PM
Edited Dec 28, 2013 at 4:58 PM
Not sure if this is the right place to ask this, but I couldn't find another way of asking if the #VALUE! error is a known bug.

I get #VALUE! errors randomly when I read cells from an excel file. The error occurs on cells that reference other cells. I know that there is an issue if a cell is NULL, but in my worksheet the cells will NEVER be NULL.

I created a xls workbook (eg KS0.xls) - inside which there is a worksheet KS0-A that has the same format line after line; a concatenate function that references 4 columns
(=CONCATENATE("Col E2: ",E244,", Col F2: ",F244,", Col G2: ",G244,", Col H2: ",H244))

cols E, F, G, H have a simple function: =CHOOSE(RANDBETWEEN(1,3),"OK1","OK2","OK3"),
so they will always have either OK1, OK2, or OK3

This is the output when I read the cells that have the concatenate function (as above): look at how #VALUE! appears randomly, suggesting there is a problem... My PHP is a simple loop that reads the lines row by row

STOP PRESS!!! I've just noticed that there is no OK1 in my output, and by laws of probability I guess that the #VALUE! errors are occurring when RANDBETWEEN(1,3) returns 1 (and so should pick OK1).... that is still a problem, but it may be a clue to a solution? Can anyone see what the problem is?

Output on RUN 1
Type:CH1 __Q1: Col E2: OK3, Col F2: OK2, Col G2: #VALUE!, Col H2: OK3
Type:CH2 __Q2: Col E2: #VALUE!, Col F2: OK3, Col G2: OK2, Col H2: OK2
Type:CH3 __Q3: Col E2: OK3, Col F2: #VALUE!, Col G2: OK3, Col H2: OK2
Type:CH4 __Q4: Col E2: #VALUE!, Col F2: #VALUE!, Col G2: OK3, Col H2: OK2

And when I run the php again i get:

Output on RUN 2
Type:CH1 __Q1: Col E2: #VALUE!, Col F2: #VALUE!, Col G2: OK3, Col H2: #VALUE!
Type:CH2 __Q2: Col E2: OK3, Col F2: OK3, Col G2: OK2, Col H2: #VALUE!
Type:CH3 __Q3: Col E2: OK3, Col F2: #VALUE!, Col G2: #VALUE!, Col H2: OK2

Type:CH4 __Q4: Col E2: OK3, Col F2: OK3, Col G2: OK2, Col H2: OK3

Fixed: see https://github.com/PHPOffice/PHPExcel/issues/258?source=cc
Marked as answer by khaneef on 12/28/2013 at 8:58 AM