Showing results for 
Search instead for 
Did you mean: 

If statement syntax issue

Hi guys I have a question about my syntax issue I’m having. I have a formula with an if statement saying if all my toggles are true, my supervisor check on my excel query is true, but can not finish the final statement. Cause if not all of the toggles are true then the check is false. My statement looks something like && windowstoggle.value=true (“true”)(“false”)}), “”) and on the first bracket infront of (“true”) it says unexpected characters and I can’t fix it
Super User
Super User

Hi @Thefournier351

Please post your formula.

Ok but wont put every toggle it’s like 15 minutes of writing lol Its in the studio can’t paste
PreStartStatus: If(AirfilterToggle.Value=false Or BatteryToggle.Value=false, “Shift”, If(ThreePointContactToggle.Value=false, “Plan”, “True”)), SupervisorCheck: If(AirfilterToggle.Value=true && BatteryToggle.Value=true (“true”),(“false”)}), “”)
My mistake is at the final line where true and false are right after each other

OK, I see one problem with  your formula off the bat.

If(AirfilterToggle.Value=true && BatteryToggle.Value=true (“true”),(“false”)}), “”)

There is a right curly bracket that probably shouldn't be there since there is no left curly bracket shown.  Also there appears to be a missing comma between the If() function condition (Airfilter.Toggle.Value=true) and the result of the condition when the condition is true.  The syntax for the If() function is:  If( Condition1, ThenResult1 [, Condition2, ThenResult2, ... [ , DefaultResult ] ] )

 If(AirfilterToggle.Value=true && BatteryToggle.Value=true, “true” , “false”)

I believe my restatement of your formula says that if both toggle values are true, then the return value "true" will be put somewhere and if either of the toggles is not true, then return value "false" will be put in the same location.  Since the two options are mutually exclusive, therre would be no need for a default result so "") is eliminated.  Maybe I'm missing something but If this is not correct, let me know.



Issue1.pngplease find my attached new issue. the bottom part was indeed fixed.

 the bottom of the formula is now fixed but the top now has an invalid argument

this is the part which has now been fixed for the most part except one highlighted sectionthis is the part which has now been fixed for the most part except one highlighted section

3rd issue right at bottom3rd issue right at bottom

My browser doesn't let me follow the If() statement beyond what is shown in the box.  Could you please isolate the offending statement with the error and repost it. 

BTW, my process for debugging formulas is to isolate each phrase and test if it works, then start connecting them.  


Helpful resources

Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,494)