I have a list of fields that may or may not contain the letter "d" or the letter "t". I need any instance where the field contains the letter "d" to replace it with "d" or any time it contains the letter "t" to replace it with "t" and if it doesn't contain either, to make the cell blank. The screenshot below shows a few examples of the original code and then the code I would like it to be. What formula could I write to accomplish this?
Original Code | New Code |
d | d |
s | |
sd | d |
sr | |
rt | t |
Solved! Go to Solution.
Hi @Ryan_Stocker ,
Something like this:
The formula is:
IF Contains([Original Code], "d") THEN "d"
ELSEIF Contains([Original Code], "t") THEN "t"
ELSE null() ENDIF
I'd approach it like this, it will check ALL columns by leveraging the transpose tool. Makes the workflow dynamic:
Before & After:
Formula:
As a final note, be careful of the contains formula, it is case insensitive by default, you can add an optional 3rd argument to change this though:
If you want to make the cell blank, edit the formula -> ELSE null().
If you want to only select certain columns, I'd just advice using the Multi-Field Formula tool. This allows you to use one formula across multiple fields. This satisfies your requirement.
All the best,
BS
Thank you everyone!