Showing results for 
Search instead for 
Did you mean: 
Regular Visitor

Switch Statement error "An unexpected exception encountered when evaluating branching condition"

The error occurred in the Switch action named “Switch Type of employee”. In this switch statement, each case for one of the 3 different types of employees. The 3 employee types are: 1, Normal, 2, Manager, and 3, Partner. The waiting periods for all types are as follows. 1: 1 month (30 days), 2: 3 months (90 days), 3: 6 months (180 days). The Switch statement condition is a column from a table in an Excel spreadsheet (see Screenshot 2) 


Whenever I run the flow, unfortunately it errors out and fails. In the “Switch Type of employee” action, the error message states “ActionFailed. An action failed. No dependant actions succeeded.” In all 3 cases of the switch statement, the 1st action is the same “Set variable TerminationDate” and they all have the same error message “ActionConditionFailed. The execution of template action 'Set_variable_WaitingPeriod_1' failed: an unexpected exception encountered when evaluating branching condition.”

This suggests that the error occurred in the “Switch Type of employee”, for that is where the condition is evaluated. (see screenshot 1) 


Screenshot 1: the error in the test run, as it appears in Microsoft Power Automate: 

Reminder to remove Microsoft E3 and E5 licenses part 2 flow test run 05-10-2021, 10.58 am screenshot 2.PNG


Screenshot 2: the table in the "RedCompass Leavers table" Excel spreadsheet 

RedCompass leavers table spreadsheet on 05-10-2021.PNG


As of today, to me it doesn’t make sense to me why the error still occurs. I suspect though that it’s something to do with the fact the Employee type values come from an Excel spreadsheet, because the similar, in fact identical action in another flow titled “Reminder to remove Microsoft E3 and E5 licenses for leaver part 1”, uses the Employee Type value from the user input form, but that has never given any error in its existence. But I am honestly not sure what else to do to fix this error. 


I have searched existing posts first 

I have done some searching of existing posts on the website. First I searched for "Switch statement on column in Excel table", then "An unexpected exception encountered when evaluating branching conditions.". However I couldn't find any posts that really answer how to fix the error I am getting. 


Regards George 

Super User
Super User


Please post a screen shot of your Flow in edit mode - be sure to show details of the switch that failed.


If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Regular Visitor

Hi Scott 


Here is a screenshot of the actions that are mentioned in my original post: 

Reminder to remove Microsoft E3 and E5 licenses part 2 flow Switch Type of Employee on 06-10-2021.PNG




Hey @ScottShearer 


Just a reminder that I'm still struggling on this. 




Helpful resources

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (1,886)