Look up column to return bold text and different colour for certain values in Modern SharePoint list

Harry N Nomikos 1,311 Reputation points
2024-12-17T23:47:20.4766667+00:00

Hi Team

I've created a look up column to return the below text values and the existing JSON formula has line break integrated in. What I want to achieve is having the below values in bold; please see below

Business Metro: Low
R&A: Low
BDSB: Low
Private Wealth: Low
Business Lending: None
Merchant Servicing: None

Can I have rating show in a different colour based on the table below

User's image

Here's the existing JSON formula, can you please amend to reflect the above requirements;

{

"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",

"elmType": "div",

"txtContent": "=replaceAll([$GRACE_x0020_ID_x003a_Comms_x00200], ',', '\n')"

}

Thanks team
Harry

SharePoint Server
SharePoint Server
A family of Microsoft on-premises document management and storage systems.
2,399 questions
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 37,076 Reputation points Microsoft Vendor
    2024-12-18T09:07:33.92+00:00

    Hi @Harry N Nomikos,

    Per my test, you could use following json to display different colour based on lookup value

    {
     "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
    "elmType": "div",
    "debugMode": true,
    "txtContent": "@currentField.lookupValue",
    "style": {
    "color": "=if(@currentField.lookupValue == 'Low', 'green', if(@currentField.lookupValue == 'Medium', 'orange', if(@currentField.lookupValue == 'High', 'red', if(@currentField.lookupValue == 'Unknown', '', if(@currentField.lookupValue == 'None', 'blue', '')))))"
     }
    }
    
    
    

    And here is the test result

    User's image


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.