Forum Discussion
abellanc
2 years agoRegular Visitor
Retain cells containing numbers while replacing others with “None”
I want to convert cells under EV that does not contain numbers to "None" and retain those that contains numbers. I tried below formula but "0".."9" portion shows an error. I replaced it with Text.Con...
- 2 years ago
=Table.ReplaceValue(YourTable,"","",(x,y,z)=>if Text.Remove(Text.From(x),{"0".."9"})=x then "None" else x,{"EV"})
BA_Pete
Super User
2 years agoHi abellanc ,
It's a little bit of a hack, but you may find it way simpler just to replace the "N/A"s with "None", something like this:
Table.ReplaceValue(
PreviousStepName,
each [EV],
each if List.Contains({"na", "n/a"}, Text.Lower([EV])) then "None" else [EV],
Replacer.ReplaceText,
{"EV"}
)
If this doesn't work as-is, then try changing Replacer.ReplaceText for Replacer.ReplaceValue.
Pete