Help

Re: Replace a word and output with original sentence value

1401 0
cancel
Showing results for 
Search instead for 
Did you mean: 
junaid2ali
5 - Automation Enthusiast
5 - Automation Enthusiast

I have a column {Sentence with Plain Value}, whenever a value that is listed in column {Plain Value} exists, I want it replaced with the value in column {Value with R Ball} and outputted with other initial values in the sentence.

 

For example:

I love to have a Big Breakfast will be -> I love to have a Big Breakfast®

A Burger is delicious -> A Burger® is deliciousScreen Shot 2023-03-07 at 2.06.12 AM.png

How can I accomplish this?

4 Replies 4
Ben_Young1
11 - Venus
11 - Venus

Hey @junaid2ali

You don't actually need the Value with R Ball field at all to do this.
Create a new formula field and give this formula a shot: 

 

 

IF(
    AND(
        {Plain Value}, {Sentence with Plain Value}
    ),
    IF(
        FIND(
            {Plain Value}, {Sentence with Plain Value}
        ),
        SUBSTITUTE(
            {Sentence with Plain Value}, {Plain Value}, {Plain Value} & "®"
        ),
        {Sentence with Plain Value}
    ),
    {Sentence with Plain Value}
)

 

 

You'll want to double check that all the field names and values are correct if it throws you an error.

AirOps
7 - App Architect
7 - App Architect

Hi @junaid2ali

You can also accomplish this by using the SUBSTITUTE Formula. Try this: 

SUBSTITUTE({Sentence With Plain Value},{Plain Value}, {Value with R ball})
 
Some more information about the SUBSTITUTE formula (curtesy of Airtable):
SUBSTITUTE(string, old_text, new_text, [index])
Replaces occurrences of old_text with new_text. You can optionally specify an index number (starting from 1) to replace just a specific occurrence of old_text. If no index number is specified, then all occurrences of old_text will be replaced
 
I hope this helps!

Thanks for this, but this solution assumes the R ball is always at the end correct? which is not the case.

IF(
    AND(
        {Plain Value}, {Sentence with Plain Value}, {Value With R Ball}
    ),
    IF(
        FIND(
            {Plain Value}, {Sentence with Plain Value}
        ),
        SUBSTITUTE(
            {Sentence with Plain Value}, {Plain Value}, {Value With R Ball}
        ),
        {Sentence with Plain Value}
    ),
    {Sentence with Plain Value}
)