Lists - How to change a cell value to 0 depending on a nother cell value/column.

Julian Paus 60 Reputation points
2023-03-05T11:54:49.7733333+00:00

Hey everyone,

I would like to change a cell value to e.g. "0" depending on a nother cell value/column. As I am not familiar with JSON I'm missing the code I could insert to get this feature.

Looking forward to your help!

Cheers

Julian

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,300 questions
0 comments No comments
{count} votes

Accepted answer
  1. RaytheonXie_MSFT 33,641 Reputation points Microsoft Vendor
    2023-03-06T02:14:48.22+00:00

    Hi @Julian Paus

    Per my test, you can use following json formatting to set column value

    {
        "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
        "elmType": "div",
        "txtContent": "=if([$Title]  == 'Result A', '0','1')"
    }
    

    The json is to set current column value to 0 when Title column value is Result A, set column value to 1 when Title column value is not Result A.

    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.


0 additional answers

Sort by: Most helpful