Forum Discussion

HodgePodge47's avatar
HodgePodge47
Copper Contributor
Oct 04, 2023
Solved

Separate Results of Calculated Column with Commas

Okay, I'm a SP List newbie and am trying to create a list of upcoming conferences for our marketing and sales staff. Included is a set of columns that shows each of our products and the percentage to...
  • ganeshsanap's avatar
    Oct 05, 2023

    HodgePodge47 Try using calculated formula like this: 

     

    =TRIM(IF([PROD-1]>0,"PROD1 ","")&IF([PROD-2]>0,"PROD2 ","")&IF([PROD-3]>0,"PROD3 ","")&IF([PROD-4]>0,"PROD4 ","")&IF([PROD-5]>0,"PROD5",""))

     

    Then apply JSON column formatting with: 

     

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

     

    ReferenceSharePoint: Replace All Occurrences of Substring in a String using JSON Formatting 

     

    You can also use internal column name instead of @currentField in JSON. You can get the internal name of your SharePoint list columns by following this article: How to find the Internal name of columns in SharePoint Online? 


    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.

Resources