Forum Discussion
Remove trailing commas
ExcelKnut Add a new custom column with the following formula:
= Text.Replace(Text.TrimEnd([YourColumnName], ","), ",,", ",")
Thanks for your quick response. Unfortunately, that didn't seem to solve the issue.
Formula used: Text.Replace(Text.TrimEnd([Race], ","), ",,", ",")
Example #1: Native American,
Example #2: Asian, Black,
- bhanu_gautam1 year ago
Super User
Use this m
= if Text.EndsWith([YourColumnName], ",") then
Text.Start([YourColumnName], Text.Length([YourColumnName]) - 1)
else
[YourColumnName]- ExcelKnut1 year agoFrequent Visitor
Great formula but for some strange reason it's not removing the trailing comma.
I copied the table into Excel and it shows the last character is a comma.
However, in Power Query, I added a column to just get the last character in that column, the commas do not appear. Then, when I get the last two characters, the commas appear.
- Anonymous1 year agoNot applicable
Hi ExcelKnut,
It looks like your data might have non-breaking spaces or invisible characters after the comma, which Power Query isn't recognizing as a simple trailing comma.
Try by removing removes leading and trailing spaces.
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!
Regards,
Vinay Pabbu