How to Add Show/Hide conditional formatting to column in Lists

Gosse, Hayley (HC/SC) 50 Reputation points
2023-07-26T17:35:35.8366667+00:00

Hello,

I want to format a date column to show or hide depending on what option is picked in a choice (not multiple selection) column. It is not working and only hiding the column instead of the command given.

I used this code to format the column I want to show/hide: =if([$Category] == 'Product Management', 'true', 'false')

Is this possible? Am I using the wrong code?

Thanks!

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

Accepted answer
  1. Emily Du-MSFT 39,446 Reputation points Microsoft Vendor
    2023-08-04T06:31:04.4333333+00:00

    I'm glad to hear you solve the problem, if you have any issue about SharePoint, you are welcome to raise a ticket in this forum.

    By the way, since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others.". So, I would make a brief summary of this thread:

    [How to Add Show/Hide conditional formatting to column in Lists]

    Issue Symptom:

    OP want to format a date column to show or hide depending on what option is picked in a choice (not multiple selection) column. It is not working and only hiding the column instead of the command given.

    OP used this code to format the column I want to show/hide: =if([$Category] == 'Product Management', 'true', 'false')

    Current status:

    OP actually figured it out. When OP created the choice column, it had a different name. OP edited it later on. When coding, the system only recognizes the column for its original name when it was created and not the new edited one.

    You could click the "Accept Answer" button for this summary to close this thread, and this can make it easier for other community member's to see the useful information when reading this thread. Thanks for your understanding!

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Emily Du-MSFT 39,446 Reputation points Microsoft Vendor
    2023-07-27T03:25:54.11+00:00

    Here are steps about how to show or hide a date and time column based on a choice column.

    1.Create a date and time column named "Date".

    2.Create a choice column named "Category" with "Product Management" and "testchoice" values .

    3.Click "+New" -> Edit columns -> Select the far right hand edge of the Date column to display the options menu (...) -> Edit conditional formula -> Use following formula.

    =if([$Category] == 'Product Management', 'true', 'false')

    1

    4.If you choose Product Management in the choice column, the Date column will show. If you choose other values in the choice column, the Date column will hide.

    2


    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.