Show or hide columns conditionally in SharePoint list form - Demo

Conditionally show or hide columns in a SharePoint list

No comments

 937 total views,  5 views today

In this conditionally show or hide columns in a SharePoint list article, we will learn how to show or hide columns conditionally in the SharePoint list form.

Conditionally show or hide: what you will learn from this article?

  • How to conditionally show and hide the column in SharePoint Online list form?
  • How to conditionally show or hide columns conditionally in SharePoint list or library form?
  • What are the supporting columns for the conditional formula in the SharePoint Online list or library?
  • Unsupported column types in conditional formulas.
  • How to work with logical operators in a conditional formula of SharePoint Columns?
  • Conditional formula example with the allowed SharePoint column types.

In order to complete this demo, we need to have a Sharepoint list.

Here is the demo list, named “Expense Claim”

Below attached the list definition. Along with the “IsApproverNeeded(Yes/No type)” and “Approver Name (People/Group type)” – it has some other columns, however, here we are interested only in these two columns. The demo output would be as, if the user selects “IsApproverNeeded” then only the “Approver Name” column will be displayed otherwise would be hidden. Now, let’s get started with the demo.

Show Hide Columns conditionally in SharePoint list form demo
Show Hide Columns conditionally in SharePoint list form demo

We have the SharePoint Online list ready with sample data.

Show Hide Columns conditionally demo with the sample SharePoint list
Show Hide Columns conditionally demo with the sample SharePoint list

Click on the “Title” column hyperlink to open the list view form.

Then, the list item will be opened in the list view form.

Click on the “Edit Form (3)” dropdown list as shown in step 3.

Click on the “Edit columns” link.

Edit columns in Online SharePoint modern list form
Edit columns in Online SharePoint modern list form

Click on the three dots next to the column name for which you want to apply the formula. Here we have selected “ApproverName” as we want to hide and show this column based on the other column values changes (IsApproverNeeded – Yes/No).

Edit columns formula in modern SharePoint Online list
Edit columns formula in modern SharePoint Online list

Click on the “Edit conditional formula” link.

Edit conditional formula in modern SharePoint Online list
Edit conditional formula in modern SharePoint Online list

Enter the below text in the edit conditional formula box:

=if([$IsApprovalNeeded]==true,'true','false')
Edit conditional formula for SharePoint field
Edit conditional formula for SharePoint field

Click on the “Save” button.

Explanation about the above formula: conditionally show or hide column

  • The above formula will return true if the “IsApproverNeeded” is selected as yes.
  • Then the field “ApproverName” will be visible only when the formula returns true.

Conditionally show or hide: what can be done using the conditional formula?

To determine whether this field is shown or hidden, specify a conditional formula based on the value of another field. Leave it blank to clear the condition.

 

Show and hide column conditionally in SharePoint Online list – Demo:

Open the list item in edit mode.

We can notice that by default “IsApprovalNeeded” is unchecked, so we cannot see the “Approver Name” column – it is hidden.

Open SharePoint list form in edit mode to show and hide the column
Open SharePoint list form in edit mode to show and hide the column

Now, click on the “IsApprovalNeeded” checkbox, then we can see that the “Approver Name” column is being shown, and if we uncheck this selection

 

Show and hide column in SharePoint list form conditionally demo
Show and hide the column in SharePoint list form conditionally demo

Note:

  • If your SharePoint list column is a required one (Require that this column contains information:), this show and hide formula cannot be applied, as today this is the limitation from Microsoft.

Let’s check out the above limitation practically.

Make the “ApproverName” column as “Require that this column contains information” and click on the OK button.

Make existing column as required in SharePoint Online
Make existing column as required in SharePoint Online

Edit conditional formula in modern SharePoint Online list is hidden when the column is required:

Now, go again to the edit columns in the form configuration, and select the “ApproverName” column, we can notice that the “Edit conditional formula” is hidden now, only we can see the “Move up” option because we have made this column as a required.

Edit conditional formula in modern SharePoint Online list is hidden when the column is required
Edit conditional formula in modern SharePoint Online list is hidden when the column is required

Working with various types of columns in SharePoint Online list for conditional formulas:

Type of the Column Formula Example
Number =if([$Cost]>2000,’true’,’false’)
Choice =if([$Department]==’HR’,’true’, ‘false’)
Date =if([$ProjectStartDate]==Date(’17/03/2021′),’true’,’false’)
Person =if([$ApproverFieldInternalName].email==’testuser@yourdomain.com’,’true’,’false’)
Yes/No (check box) =if([$IsApproverNeeded]==true,’true’,’false’)

Note:

  • We can use @me for the currently logged-in user for the filter.

We even can add/subtract the value of fields before comparing, below is the example:

=if([$Column1]+[$Column2]<3000,'true','false')

Logical operators in the conditional formula in SharePoint Online list

Logical operators are also allowed inside the conditional formula in SharePoint online list.

Logical Operator Description
&& Logical AND operator
|| Logical OR Operator
! Logical NOT Operator

Limitation – column types not supported in conditional formulas in SharePoint list/library:

As of today, below list of columns is not supported in the conditional formula in the SharePoint list.

  • Choice with multiple selections
  • Time calculations in the Date and Time column
  • Currency columns
  • Location columns
  • Calculated columns
  • Person or Group with multiple selections

Summary: What we had here?

Thus, in this article we have learned the below with respect to show and hide column conditionally in SharePoint Online list form:

  • How to conditionally show and hide the column in SharePoint Online list form?
  • How to conditionally show or hide columns conditionally in SharePoint list or library form?
  • What are the supporting columns for the conditional formula in the SharePoint Online list or library?
  • Unsupported column types in conditional formulas.
  • How to work with logical operators in a conditional formula of SharePoint Columns?
  • Conditional formula example with the allowed SharePoint column types (Single Line Text, Choice, Yes/No, People, Number, Date)

See Also:

You may also like the below SharePoint/PowerApps article:

Buy the premium version of SharePoint Online & Office 365 administration eBook from here:


Buy SharePoint Online & Office 365 Administration eBook