Home > database >  Google Sheets replace spaces with -, remove parentheses and periods
Google Sheets replace spaces with -, remove parentheses and periods

Time:01-10

I am attempting to generate a string to use in a URL from some data in a Google Sheet.

Here is a number or rows

Logan
Louisville
North Seattle (Lynnwood)
Mesa
Minneapolis
Nashville
National City
St. Paul (Oakdale)
Oklahoma City

I need to replace spaces with a -, then remove any periods or parentheses. This is where I am at now, which works for spaces but not sure where to go for periods and parentheses

substitute(lower(A1)," ","-")

Would, inside lower(), I use REGEXREPLACE to look for periods and parentheses?

looking for an output of

logan
louisville
north-seattle-lynnwood
mesa
minneapolis
nashville
national-city
st-paul-pakdale
oklahoma-city

Thanks

CodePudding user response:

try:

=INDEX(LOWER(REGEXREPLACE(REGEXREPLACE(A1:A, "[\(\).]", ), " ", "-")))

enter image description here

  •  Tags:  
  • Related