Get startedGet started for free

Create campaign IDs using REGEXEXTRACT()

After much thought, and testing different naming conventions, the digital marketing director and the social media team have finally settled on a naming convention. They have decided to simply create campaign IDs.

These IDs will contain information about the source and campaign. For instance, the test IDs you create will be in the following format: the first letter from the Source, followed by an underscore, then the full Campaign Name. For example, the campaign ID for the source Yahoo with a campaign Spreadsheets would be: Y_Spreadsheets.

Recall that a begin anchor is ^. For example, ^f will match the f in flying. However, in this exercise you will need to be able to match the first letter from any word.

This exercise is part of the course

Marketing Analytics in Google Sheets

View Course

Exercise instructions

  • In cell I2, write a regular expression that will extract only the first character in a string.
  • In cell F2, write a formula to create the new test IDs:
    • Use REGEXEXTRACT() to pull the first letter from cell A2 using your pattern in I2 (as an absolute reference).
    • In the same cell, use t& characters to add a "_" and the campaign name (in cell B2).
  • Apply this formula to the remainder of the cells in the column, F3:F29.

Hands-on interactive exercise

Turn theory into action with one of our interactive exercises

Start Exercise