Forum Discussion
MBroman
1 year agoNew Member
Using Text.Length in an IF Statement
Hello, I am trying convert an Excel formula to be used in Power Query. The Excel formula is =IF($K2>0,"Account",IF(LEN($H2)>3,"5 Dig","3 Dig")). From my research I've come up with the following formu...
- 1 year ago
I am pretty sure the M Code you gave is not the actual M code giving the error, because ther is a syntax error in it. No closing ) for the Text.Length()
Please post (screenshots of) your data, some or all of the surrounding M Code and a screenshot of the error. By the look of it, the error might occur somewhere else...
Prasad_chattu
1 year agoRegular Visitor
Hello MBroman
Please try the below M Code:
if [Account] <> 0 then "Account"
else if Text.Length(Text.From([ZIP CODE])) > 3 then "5 Dig"
else "3 Dig"