Skip to main content

Fixed: "Unexpected Characters. Characters Are Used in the Formula in an Unexpected Way" in Power Apps

· 5 min read
Jagdish Kumawat
Founder @ Dewiride

A control gets a red error icon, and its details say Unexpected characters. Characters are used in the formula in an unexpected way. Power Apps found a character it can't place in one of the control's formulas. In the example it was one closing bracket too many.

The Error​

In the Career Development Plan app, an Open button in a gallery row, btnOpenMPS, should sit in the middle of the row. Its Y property was meant to be (Parent.TemplateHeight - Self.Height) / 2. Instead the button jumped to the top of the row, and a red X appeared next to it. Its menu offers Edit in the formula bar and Get help for this error:

A gallery row with the Open button at the top edge, a red error icon next to it, and its menu open with Edit in the formula bar and Get help for this error

The properties pane showed Y as 0. The button had no usable value, so it sat at the top.

Find the Property with the Error​

A control has many properties, and the icon doesn't say which one is wrong. The App checker (the stethoscope icon on the right) does. Select Recheck all, wait for the check to finish, and open Formulas:

The App checker's Formulas page: Errors (1), My Plan Screen (1), Unexpected characters. Characters... on btnOpenMPS .Y, next to the canvas with the error icon on the Open button

The arrow next to the item opens its details, with the property in Location:

The Details pane: Issue Unexpected characters. Characters are used in the formula in an unexpected way, an example about the character backslash after the number 32, Location btnOpenMPS .Y, How to fix Remove or replace the unexpected characters, and a link to the formula reference

Issue details
Issue: Unexpected characters. Characters are used in the formula in an unexpected way.
Location: btnOpenMPS .Y
How to fix: Remove or replace the unexpected characters.

Read the Formula​

Select the control, pick Y in the property list, and look at the formula bar. The red wavy line marks the character that doesn't fit, here the last ):

The formula bar with (Parent.TemplateHeight - Self.Height) / 2) and a red wavy line under the final bracket, and the preview strip reading There is an error in this formula. Try revising the formula and running it again

btnOpenMPS → Y (error)
(Parent.TemplateHeight - Self.Height) / 2)

Two brackets close, but only one opened. In the example the extra one came from the formula bar, which adds a closing bracket automatically while a formula is being entered.

The Fix​

Remove the extra character:

btnOpenMPS → Y
(Parent.TemplateHeight - Self.Height) / 2

The preview strip shows the value, 40, the button moved to the middle of the row, and the error icon was gone:

The formula bar with (Parent.TemplateHeight - Self.Height) / 2 and the preview strip reading = 40 with Data type number, and the Open buttons centered in both rows without an error icon

Common Mistakes​

MistakeWhat happensDo this instead
Looking for the error in Text or OnSelect onlyThe broken property is somewhere elseRead Location in the App checker
Deleting characters until the error goes awayThe formula can end up valid but wrongCount the brackets, then check the preview strip's value

Troubleshooting​

SymptomLikely causeFix
The App checker still lists the error after the fixThe list isn't refreshedSelect Recheck all and wait
The wavy line is under a word, not a bracketA different character is out of place, such as a missing operatorRead the formula from left to right around the marked spot

FAQ​

What counts as an unexpected character?​

Anything Power Fx can't fit at that position. The checker's own example is a backslash right after a number, as in 32\. In the example, it was a closing bracket with no opening one.

Why did the control move to the top?​

Y had no usable value while its formula was broken, so the properties pane showed 0 and the button sat at the top of the row.

Conclusion​

Unexpected characters points to one property with a stray character. Use the App checker's Location to find it, look for the red wavy line in the formula bar, and remove or replace the character. Then check that the preview strip shows the value you expect.

Additional Resources​

Stay Updated

Subscribe to our newsletter for the latest tutorials, tech insights, and developer news.

By subscribing, you agree to our privacy policy. Unsubscribe at any time.