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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.