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...
- 3 years ago
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]
Syk
Resident Rockstar
3 years agoIf your ID's are a specific length, you can use text.end
try
if Text.Contains([Employee ID], "T") then "0" & text.right(Employee ID,4) else [Employee ID]- apeeltyler3 years agoFrequent 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])- Syk3 years ago
Resident Rockstar
My bad! It's text.end 🙂
- apeeltyler3 years agoFrequent Visitor
It's funny because that "worked", no Syntax Errors were detected, but all results came back as Error. Employee ID is a Whole Number column