Forum Discussion

Sinan621's avatar
Sinan621
Copper Contributor
Mar 02, 2020
Solved

Sharepoint Online, number column NOT aligned right

Hello, 

 

i have a sharepoint online custom list with number column(s) with decimals and thousands separator. As far as I understand, numbers should be aligned right by default?

 

However in my case all numbers are aligned left which looks a bit odd (see screen shot).

 

What am I doing wrong?

 

Thanks for your help!

Sinan

  • Sinan621 

     

    Yes, you need to replace the formula:

    =TEXT([Column],"###,###.00")

     

    This type of modification doesn’t have any impact on the original column

     

    Thanks

14 Replies

  • FabioO365GoD's avatar
    FabioO365GoD
    Brass Contributor

    Sinan621 

     

    Hi

     

    Default Sharepoint aligns left!

     

    If you want to align the text to the right, you should copy the following code and paste it in the

    JSON Formatting to Customize

     

     

    {
    "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
    "elmType": "div",
    "style": {
    "display": "table",
    "width": "100%"
    },
    "children": [
    {
    "elmType": "div",
    "txtContent": "@currentField",
    "style": {
    "display": "table-cell",
    "text-align": "right",
    "vertical-align": "middle"
    }
    }
    ]
    }

     

    Thanks

    • Sinan621's avatar
      Sinan621
      Copper Contributor

      FabioO365GoD 

       

      Many thanks for your quick reply!

       

      I copy/pasted your solution. Result is that the numbers are now aligned right but I lost the thousand separator and decimals with zeros (not showing). See screen shot below.

       

      Basically it looks like numbers are converted into text? Is there a solution to align right AND keep the number formatting including thousand separator and number decimals for all rows?

       

      I feel like we are almost there... 🙂

       

      Cheers

       

       

       

      • FabioO365GoD's avatar
        FabioO365GoD
        Brass Contributor

        Sinan621 

         

        I'm sorry but it takes more steps!

        Sharepoint doesn't have the possibility to set decimal numbers.

        As first thing to do you need to create a column, computed with the following formula:

        =TEXT([column],".00")

         

        Then insert the following code

         

        {
        "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
        "elmType": "div",
        "style": {
        "display": "table",
        "width": "100%"
        },
        "children": [
        {
        "elmType": "div",
        "txtContent": "@currentField",
        "style": {
        "display": "table-cell",
        "text-align": "right",
        "vertical-align": "middle"
        }
        }
        ]
        }

         

        Thanks

         

Resources