Skip to main content
Solved

Substitute Spaces with Hyphens on Multiple Select Field

  • October 16, 2021
  • 2 replies
  • 54 views

I have a a Multiple Select Field which I am trying to substitute spaces with hyphens. The issue that I am running against is that the is space between items and the formula adds an extra hyphen in the final result. I am using LOWER(SUBSTITUTE(Series, " ", “-”))
See screenshot for field details and results.

Thanks for the help!!
substitute issue|700x237

Best answer by kuovonne

Welcome to the Airtable community!

You can substitute the comma and space between items with something else, then replace spaces with hyphens, and then finally put the comma and spaces back.

SUBSTITUTE(
    SUBSTITUTE(
        SUBSTITUTE(
            LOWER(Series),
            ", ",
            "TEMP"
        ),
        " ",
        "-"
    ),
    "TEMP",
    ", "
)

2 replies

kuovonne
Forum|alt.badge.img+29
  • Brainy
  • Answer
  • October 16, 2021

Welcome to the Airtable community!

You can substitute the comma and space between items with something else, then replace spaces with hyphens, and then finally put the comma and spaces back.

SUBSTITUTE(
    SUBSTITUTE(
        SUBSTITUTE(
            LOWER(Series),
            ", ",
            "TEMP"
        ),
        " ",
        "-"
    ),
    "TEMP",
    ", "
)

  • Author
  • New Participant
  • October 16, 2021

Welcome to the Airtable community!

You can substitute the comma and space between items with something else, then replace spaces with hyphens, and then finally put the comma and spaces back.

SUBSTITUTE(
    SUBSTITUTE(
        SUBSTITUTE(
            LOWER(Series),
            ", ",
            "TEMP"
        ),
        " ",
        "-"
    ),
    "TEMP",
    ", "
)

That did it. Thank you!