SOLVED

Conditional formula to hide/show columns in Sharepoint List Edit Form

Brass Contributor

Hi,

I was able to create a formula based on this posting from Microsoft (link below) and it works great.  However, I want to be able to write it so it looks at 2 different values in a field to show the column or not in the Edit Form.  Can someone help me write the formula so that I can have an OR.....like in the example below I would like to have it work if "Category" equals Product OR Service.  

 

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

 

https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/list-form-conditional-show...

 

I did see someone say that this could be used as the indicator for or || but I wrote the formula lots of ways and never could get it to work.  Thank you.

5 Replies
Hi, have you tried using like the below

=if([$Category]=='Product',=if([$Category]=='Service','true', 'false'), 'false')
best response confirmed by cmaly (Brass Contributor)
Solution
Hi,
Try this, it should work like a charm

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

@Sudharsan K   Thank you!!  This worked perfectly

Hey is there a way to do this but for if you want both conditions to be true for it to show instead of just one, E.g. for when you are referencing 2 different columns and one is a number as seen below.

=if([$Category]=='Product',=if([$Inventory]>='2','true', 'false'), 'false')

If Category is ‘Product’ and Inventory is 2 or less

Hi @LCarroll5554 

 

Try this

=if([$Category]=='Product' && [$Inventory]>=2,'true', 'false')

 

1 best response

Accepted Solutions
best response confirmed by cmaly (Brass Contributor)
Solution
Hi,
Try this, it should work like a charm

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

View solution in original post