Jump to content

Keeping 2 decimal points even if they are zeros.


njdubois

Recommended Posts

I am creating an excel report that displays a username and their score.

 

These are a few examples of what I am going for :

3.50

4.00

1.45

 

In the excel report these numbers show as

3.5

4

1.45

 

or so on... I want the 2 points always shown but everything I find online strips them.  I'm not using any features of excel.  Just saying put this number here.

 

I'm about to just pad the variable with zeros but am hoping there is a built in function?

 

Thanks for taking a look!  Your help is always very appreciated!

Nick

Thanks for the uber fast reply!!!

 

Guess I should have included this.

 

These are the 2 functions I have tried :

 

$current_score=number_format((float)$current_score, 2, '.', '');

$current_score=round($current_score, 2);

 

Your saying that excel is formatting the numbers and that I will have to turn $current_score into a string to stop excel from stripping my numbers?

 

I will take a look.

 

Thanks

Nick

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.