Forum Discussion
jak8282
Helper III
3 years agoNot working Valid out correctly
Hi, I have the following code but for some reason it is returning 54225690 as Invalid - can anyone see why - even chatgpt is saying everything looks OK? Thanks Landline Quality =
IF(...
jak8282
Helper III
3 years agoFor some reason, making it a custom column in Power Query fixed this issue
each let
LandLine = [Landline Number],
lenLandLine = Text.Length(LandLine),
containsInvalidChar = List.AnyTrue(List.Transform({"*", "&", "%", "$", "£", "!", "^", "+", ";", ":", " ", "?", "<", "-", "(", ")", "[", "]"}, each Text.Contains(LandLine, _))),
containsInvalidSequence = List.AnyTrue(List.Transform({"*1111*", "*2222*", "*3333*", "*4444*", "*5555*", "*6666*", "*7777*", "0*", "*8888*", "*9999*", "*00000*", "*012345*", "*123456*", "*234567*", "*345678*", "*456789*"}, each Text.Contains(LandLine, _)))
in
if LandLine = "" then "Missing"
else if lenLandLine < 5 or lenLandLine > 15 or containsInvalidChar or containsInvalidSequence then "Invalid"
else "Valid")