megalomania
December 27th, 2007, 09:07 PM
I am redoing the molecular format of the energetic materials on my website and I am running into an annoying problem. I have all of the molecular formulas properly subscripted in word, but subscripts do not copy and paste into Dreamweaver. In Dreamweaver the sub/sup script code snippet is buried deep, so manually changing every occurrence of a number to have a subscript tag wrapped around it is quite tedious.
What I have are a large number of formulas that have no subscript at all. I want to paste these into my excel list which I use to organize and sort data. I can’t figure out a way to write a (excel)formula that will take a number in the format of CxHyNzOw and add the appropriate tags around the number. I also tried using regular expressions to make the replacements in Dreamweaver. I can FIND the numbers, but I can’t seem to add content both before and after the number while keeping that same number.
Not all formulas will have N or O, some have additional molecules, and the numbers can be 1 or 2 digits long, and in a few cases 3.
How can I take a formula such as C6H2(NO2)3ONH4 and using an excel formula display this in the format of C<sub>6</sub>H<sub>2</sub>(NO<sub>2</sub>)<sub>3</sub>ONH<sub>4</sub>? Obviously the example formula does not follow the usual CxHyAzBwCvDu format of an empirical formula; not all formulas I have follow the format, so no formula can anticipate this format. I want a formula that will take digit X and make it <sub>X</sub>.
I hope I explained that clearly. I don’t want a “find and replace” I want a “find and add before and after” type formula that only works on digits in varying lengths and locations in a text string.
What I have are a large number of formulas that have no subscript at all. I want to paste these into my excel list which I use to organize and sort data. I can’t figure out a way to write a (excel)formula that will take a number in the format of CxHyNzOw and add the appropriate tags around the number. I also tried using regular expressions to make the replacements in Dreamweaver. I can FIND the numbers, but I can’t seem to add content both before and after the number while keeping that same number.
Not all formulas will have N or O, some have additional molecules, and the numbers can be 1 or 2 digits long, and in a few cases 3.
How can I take a formula such as C6H2(NO2)3ONH4 and using an excel formula display this in the format of C<sub>6</sub>H<sub>2</sub>(NO<sub>2</sub>)<sub>3</sub>ONH<sub>4</sub>? Obviously the example formula does not follow the usual CxHyAzBwCvDu format of an empirical formula; not all formulas I have follow the format, so no formula can anticipate this format. I want a formula that will take digit X and make it <sub>X</sub>.
I hope I explained that clearly. I don’t want a “find and replace” I want a “find and add before and after” type formula that only works on digits in varying lengths and locations in a text string.