Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I substitute quotation marks in Excel with SUBSTITUTE formula?

I have worksheet where I need named ranges to correspond to the contents of another cell. The text in the cell is something like:

Partitions w Studs 16" oc 

Named ranges cannot have spaces, or most importantly, special characters like ". So, the range is named the following:

PartitionswStuds16oc 

To change the former into a reference to the latter in the worksheet, I can handle removing the spaces with the following formula:

=SUBSTITUTE(B1," ","") 

I cannot, however, substitute the " because the double-quotation mark is used to specify text in the formula. Excel can't parse the following formula, as expected:

=SUBSTITUTE(SUBSTITUTE(B1," ",""),""","") 

Any tips on how to get around this? I know I could change the text to say 16-in. instead of 16", but I want to keep it as my client requested if possible.

like image 775
Excellll Avatar asked Apr 17 '11 17:04

Excellll


People also ask

How do you replace quotation marks in Excel?

In the Find and Replace dialog box, click the Replace tab, enter a quote mark “ into the Find what box, and keep the Replace with box blank, then click the Replace All button.

How do you replace quotation marks?

someWord. Replace(@""", "&");

How do I put a quote in an Excel formula?

Use "CHAR(34)" within formulas where you need to output quotation marks. For example, to add quotes around the text in cell A1, you would type "=CHAR(34)&A1&CHAR(34)" in an empty cell.


1 Answers

"""" escapes a ":

=SUBSTITUTE(SUBSTITUTE(B1," ",""), """", "") 
like image 169
Alex K. Avatar answered Sep 19 '22 05:09

Alex K.