SOLVED

How to add in '%' after all values in a column in a Sharepoint list

Copper Contributor

Hi, 

 

I have a list which has a column with scores in which is set to 2 decimal places, this column is populated with a Flow. 

 

I would like all values to be formatted as 00.00%. How do I format in a '%' symbol after each value submitted into the column? I have tried going into the advanced mode in conditional formatting, but cannot get it to work.

 

Thank you for your time!

3 Replies
best response confirmed by Tom2595 (Copper Contributor)
Solution

@Tom2595 the JSON for adding a % symbol to each item in the column is:

 

 

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
  "elmType": "div",
  "txtContent": "=@currentField + '%'" 
}

 

 

What you will notice is that the JSON ignores the decimal place setting for the column, and if the column has a value like 14.20% it will drop the 0 and display just 14.2%. It's fine if the value is 8.75% for example. I've not yet found a good way to force it to  display the trailing 0.

 

appendText.jpg

 

Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)

Hi Rob - I added the "=@currentField + '%'" into the JSON I had for conditional formatting. I had some numbers in there which were being populated through a Flow which went to quite a few decimal places. To rectify this I added a number formatting step into the Flow to ensure the input always had a maximum of 2 decimal places. Thank you very much for your help!

@Tom2595 @RobElliott Great way of using JSON formatting to achieve such requirements. I like JSON formatting capabilities in SharePoint online.

Also, if you are using a column of data type Number, you can try this SharePoint OOTB setting to append % to number column: 

ganeshsanap_0-1642423641256.png


Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

1 best response

Accepted Solutions
best response confirmed by Tom2595 (Copper Contributor)
Solution

@Tom2595 the JSON for adding a % symbol to each item in the column is:

 

 

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
  "elmType": "div",
  "txtContent": "=@currentField + '%'" 
}

 

 

What you will notice is that the JSON ignores the decimal place setting for the column, and if the column has a value like 14.20% it will drop the 0 and display just 14.2%. It's fine if the value is 8.75% for example. I've not yet found a good way to force it to  display the trailing 0.

 

appendText.jpg

 

Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)

View solution in original post