Rename brand campaigns using REGEXREPLACE()
Campaign names are never set in stone. In this case, your marketing director has informed you of a naming convention change to help comply with the naming conventions of the social media marketing team. In order to comply with the naming conventions, all 'Brand' words need to be changed to 'Branded'.
In this exercise, you will use an IF()
statement with REGEXMATCH()
to find the branded campaigns, then replace the word Brand
with Branded
using REGEXREPLACE()
.
- Recall that with
REGEXMATCH()
, you first supply the test cell, and then you supply the regex pattern. - With
REGEXREPLACE()
you supply the text (in this case the cell), your regex pattern, and the new string you want to swap in.
A pattern to match branded campaigns is already written for you in cell I2
.
This exercise is part of the course
Marketing Analytics in Google Sheets
Exercise instructions
- In cell
F2
, add anIF()
statement:- As your first argument, test if cell
B2
contains the pattern in$I$2
usingREGEXMATCH()
. - As your second argument (if the match is
TRUE
), useREGEXREPLACE()
to replace then contents ofB2
which matches$I$2
with"Branded"
, - Lastly, as your third argument (if the match is
FALSE
) return the tested cellB2
.
- As your first argument, test if cell
- Apply the formula to the remainder of the cells,
F3:F29
. - As a starting point, your formula should be structured like this:
IF(REGEXMATCH(___,___), REGEXREPLACE(___,___,___), ___)
Hands-on interactive exercise
Turn theory into action with one of our interactive exercises
