Calculation in Excel and PHP/SQL with different result

Asked

Viewed 65 times

0

I made the calculation of a column in my spreadsheet and the value is X. However, when I calculate the column with SQL using SUM, or even in a loop with PHP, the value is different.

The funny thing is that the values between SQL/PHP match, the result of Excel is the only different.

In the column there are values with the following formatting: 8.923245614035087, and also there are values with E, some blank...

  • 1

    this is simple to solve, limit the number of digits after the comma to for example 5 digits in both, which will get the same result. In php use numbr_format($numero,'2') and excel has an icon for this.

  • It turns out I need the exact number for the calculation, since it will be used for graphics, etc...

  • Can inform why PHP/SQL and EXCEL interpret differently?

  • 1

    Interprets for the reason described above, the number of digits after the comma. I use for graphics constantly this function that I mentioned and always leave 5 characters, the accuracy will be practically the same, except if applied for rainfall use. General data. Experiment in both how many digits will be satisfactory.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.