Forum Discussion
apeeltyler
3 years agoFrequent Visitor
I'm using Text.Contains and need to remove a single text value and add another value in its place.
Below is the formula I'm using
if Text.Contains([Employee ID], "T") then "0" else [Employee ID]
What I'm after is if the Employee ID contains a 'T', for example: T0123, I want to remove the 'T' and add a '0' (zero) in place of the 'T'.
How do I accomplish this?
If your ID's are a specific length, you can use text.end
tryif Text.Contains([Employee ID], "T") then "0" & text.right(Employee ID,4) else [Employee ID]
6 Replies
- Syk
Resident Rockstar
If your ID's are a specific length, you can use text.end
tryif Text.Contains([Employee ID], "T") then "0" & text.right(Employee ID,4) else [Employee ID]- apeeltylerFrequent Visitor
Thanks! However, I'm getting this error:
Expression.Error: The name 'Text.Right' wasn't recognized. Make sure it's spelled correctly.
edit to add:
If it helps, I'm in Power Query Editor creating a new column
= Table.AddColumn(#"Removed Columns2", "EE ID", each if Text.Contains([Employee ID], "T") then "0" & Text.Right([Employee ID],4) else [Employee ID])- Syk
Resident Rockstar
My bad! It's text.end 🙂