Forum Discussion
Convert number with text to number
- 3 years ago
Hi SenoirB
I modified AntrikshSharma 's solution as below. You can use this code to create a custom column.
let result = Text.Replace ( Text.Replace ( Text.Replace ( Text.Replace ( [Time], " ", "" ), "h", "*60+" ), "m", "*1+" ), "s", "/60" ) in if Text.EndsWith(result, "+") then Expression.Evaluate(Text.Range(result, 0, Text.Length(result)-1)) else Expression.Evaluate(result)Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
Here is another way to solve this:
Expression.Evaluate (
Text.Replace (
Text.Replace (
Text.Replace (
Text.Replace ( [Time], " ", "" ),
"h", "*60+"
),
"m", "*1+"
),
"s", "/60"
)
)
This one was really close but I get an error if there isn't a "s" on the value. Very few of the entries have a value that looks like this: 14 m
I didn't know these were on the there without seeing the errors from the Custom Column. I tried to come up with a solution by Splitting the column and replacing values and couldn't.
- v-jingzhang3 years agoCommunity Support
Hi SenoirB
I modified AntrikshSharma 's solution as below. You can use this code to create a custom column.
let result = Text.Replace ( Text.Replace ( Text.Replace ( Text.Replace ( [Time], " ", "" ), "h", "*60+" ), "m", "*1+" ), "s", "/60" ) in if Text.EndsWith(result, "+") then Expression.Evaluate(Text.Range(result, 0, Text.Length(result)-1)) else Expression.Evaluate(result)Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.- SenoirB3 years agoFrequent Visitor
This worked perfectly! Thank you!