Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8862409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:43:18+00:00 2026-06-14T15:43:18+00:00

My code uses the getFormattedValue() method to pull the data into PHP . Here

  • 0

My code uses the getFormattedValue() method to pull the data into PHP.

Here is the problem part of .xls with “numbers stored as text” at column D:

Excel cells contains next values:   D7 -> 0,43;  E7 -> =D7*1,2;  F7 -> =E7*11,2;
getFormattedValue() returns:          0,43;        #VALUE!;          #VALUE!;
getCalculatedValue() also returns     0,43;        #VALUE!;          #VALUE!;
getValue() returns                    0,43;        D7*1.2;           E7*11.2;

If I fix it in excel, as it propose, to number. then getFormattedValue() work just fine.
But I can’t tell to client that your xls is wrong…

So question, is it possible get PHPExcel to act like Excel? Or maybe some other method to make this work.

Thank you for your help and time!

— EDIT 1 —

Basicly it’s a comment to Mark Baker’s answer.

I would like to find a solution that doesn’t include any changes to .xls files. I don’t know what structure it would be, where is the problem cells, etc.

Is there some way to make PHPExcel recognize that cells? Maybe how MS Excel do that? Or find out our method to do that.

I think about trying to divide cell value by itself and if we get 1 so that’s a numeric cell. AND\OR find cells that are included in mathematical calculations. To better understand what i mean – cell E7 contains D7*1,2. So, we can check – is D7 numeric? Something like that.

At this time I don’t have any solution to this problem… So any help would be great.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T15:43:19+00:00Added an answer on June 14, 2026 at 3:43 pm

    You would need to convert those string values in column D to a valid numeric (using a decimal point rather than a comma) before getting the values from cells in columns E and F. If the problematic cells are always in the same column (or at least predictable) you could use a cell binder to handle this conversion when the workbook is loaded.

    EDIT

    You’d need to create a binder something like:

    class PHPExcel_Cell_AdvancedValueBinder 
        extends PHPExcel_Cell_DefaultValueBinder 
        implements PHPExcel_Cell_IValueBinder
    {
        public function bindValue(PHPExcel_Cell $cell, $value = null)
        {
    
            // sanitize UTF-8 strings
            if (is_string($value)) {
                $value = PHPExcel_Shared_String::SanitizeUTF8($value);
            }
    
            // Find out data type
            $dataType = parent::dataTypeForValue($value);
    
            if ($dataType === PHPExcel_Cell_DataType::TYPE_STRING && 
                !$value instanceof PHPExcel_RichText) {
                if (preg_match('/^\d+,\d+$/', $value)) {
                    list($w, $d) = explode(',', $value);
                    $value = (float) $w . '.' . $d;
                    $cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
                    return true;
                }
            }
    
            // Not bound yet? Use parent...
            return parent::bindValue($cell, $value);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

trying to duplicate some PHP code in C#. The PHP code uses the uniqid
The following PHP code uses cURL, XPath and displays all the links on a
I have some JavaScript code in my php website. This code uses jQuery, and
I am refactoring some existing Delphi code into a class. The current code uses
At present, the structure of my code uses XmlDocument to load Xml data and
The idea behind this code is that it uses an extension method to instantiate
a part of my code uses the html returned from the ajax call to
Here's the explanatory code. The language is Java and the code uses Android. fg.setTextSize(height*0.50f);
I am going through some code uses the name method of a Java Enum.
My code uses a text based conf file with key=value type entries. I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.