Equation Evaluate 1+2 3125x12 150012x3-99 -6322:7 3.142857143125x(5+7:2) 1062.534:(9x0.6-3)^3 2843.1712963^(34:(9x0.6-3)) 5744044.2282^7 1287^0 15-"" check the syntax 2:0 check the syntax Ax9 check the syntax 3=2 FALSE3<>2 TRUE5:0.+3 check the syntax 5:0x4 check the syntax 0^7 00.59x3.21:0.5:0 check the syntax 5x(3+2 check the syntax 6^ check the syntax 2^-3 0.12527^1/3 32^(1/2) 1.4142135623^(1/2) 1.73205080810^(1/10) 1.258925412Ln(10) 2.302585093Log(2) 0.693147181
Code:// Evaluate let Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content], Null = Table.SelectRows(Source, each ([Equation] <> null)), RepColon = Table.ReplaceValue(Null,":","/",Replacer.ReplaceText,{"Equation"}), RepAsterisk = Table.ReplaceValue(RepColon,"x","*",Replacer.ReplaceText,{"Equation"}), EE = Table.AddColumn(RepAsterisk, "Evaluate", each try if Text.Contains([Equation], "/0") or Text.Contains([Equation], "/0.") then "check the syntax" else if Text.Contains([Equation], "Log") then Number.Log(Number.From(Text.BetweenDelimiters([Equation], "(", ")"))) else if Text.Contains([Equation], "Ln") then Number.Ln(Number.From(Text.BetweenDelimiters([Equation], "(", ")"))) else if Text.Contains([Equation], "^") then Number.Power(Expression.Evaluate(Text.BeforeDelimiter([Equation], "^")), Expression.Evaluate(Text.AfterDelimiter([Equation], "^"))) else Expression.Evaluate([Equation]) otherwise "check the syntax"), TSC = Table.SelectColumns(EE,{"Evaluate"}) in TSC






Bookmarks