Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Combine two cells in a new cell, replace all spaces with dash, and lowercase

Trying to combine two cells in a Google spreadsheet, replace all the spaces with a "-", and lowercase everything.

Cell 1: GWG-1

Cell 2: Product Name 1

New Cell 3: gwg-1-product-name-1

like image 355
frshjb373 Avatar asked Jul 15 '16 21:07

frshjb373


People also ask

How do I change a dash to a space in Excel?

Replacing spaces using Find and Replace You can also click the Home tab in the Ribbon and select Replace in the Find & Select group. In the Find what box, type a space. In the Replace with box, type an underscore, dash, or other value. If you want to replace the space with nothing, leave the box blank.

How do I get rid of spaces and dashes in Excel?

In an adjacent blank cell, C1 for instance, enter this formula: =SUBSTITUTE(A1,"-",""), see screenshot: 2. Press Enter key, and select cell C1, then drag the fill handle to the range that you want to contain this formula. And the dashes between the numbers have been removed.


1 Answers

Your basic formula is:

=LOWER(SUBSTITUTE(A1," ","-"))

We can concatenate two cells together to get the desired output:

=LOWER(SUBSTITUTE(A1&"-"&B1," ","-"))

enter image description here


Google Sheets

enter image description here

like image 151
Scott Craner Avatar answered Jan 28 '23 07:01

Scott Craner