Forum Discussion

RenPNW's avatar
RenPNW
Copper Contributor
Apr 12, 2024

how to add an OR statement to formula

Hi,

Looking for some help on this formula:

If(varTabSelected=1,(DataCardValue71.Selected.Value = "Diversion"),Or(DataCardValue72.Selected.Value = "Diversion"))
 
I have a column that I want to be visible only if it meets the following criteria
I have three tabs, only If Tab one is selected
AND
if Data card Value71 = Diversion
OR
if Data Card Value72= Diversion
If I remove the last statement it works fine, as expected,but when i add the second Data card value it works for the value 71= Diversion but selecting Diversion only on the Value72  does not work.
What is wrong with that statement, I am a newbie to Sharepoint.
 
Thanks in advance
 
Ren
  • RenPNW,

     

    Formula suggested by Rob_Elliott should work for you.

     

    However, And and Or function already returns true/false result. Hence, no need to use If function. Use shorter formula like: 

     

    varTabSelected=1 && (DataCardValue71.Selected.Value = "Diversion" || DataCardValue72.Selected.Value = "Diversion")

     

    OR 

     

    And(varTabSelected=1, Or(DataCardValue71.Selected.Value = "Diversion", DataCardValue72.Selected.Value = "Diversion"))

     


    Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

  • Rob_Elliott's avatar
    Rob_Elliott
    Bronze Contributor

    RenPNW the syntax needs to follow the following pattern:

    If(
     And(
       Or(
        cb1.Selected.Value = "Diversion", cb2.Selected.Value = "Diversion"
        ),
        varTabSelected=1),
        true, false
    )
     
    Rob
    Los Gallardos
    Microsoft Power Automate Community Super User.
    Principal Consultant, SharePoint and Power Platform WSP Global (and classic 1967 Morris Traveller driver)
  • RenPNW,

     

    Formula suggested by Rob_Elliott should work for you.

     

    However, And and Or function already returns true/false result. Hence, no need to use If function. Use shorter formula like: 

     

    varTabSelected=1 && (DataCardValue71.Selected.Value = "Diversion" || DataCardValue72.Selected.Value = "Diversion")

     

    OR 

     

    And(varTabSelected=1, Or(DataCardValue71.Selected.Value = "Diversion", DataCardValue72.Selected.Value = "Diversion"))

     


    Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

Resources