View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Bernard Liengme Bernard Liengme is offline
external usenet poster
 
Posts: 4,393
Default NC tape conversion

Another way is to use a User Defined Function - see below
If you are new to VBA see David McRitchie's site on "getting started" with
VBA
http://www.mvps.org/dmcritchie/excel/getstarted.htm
best wishes

Function Twister(oldcode)
x = InStr(1, oldcode, "X")
y = InStr(1, oldcode, "Y")
i = InStr(1, oldcode, "I")
j = InStr(1, oldcode, "J")
z = InStr(1, oldcode, "Z")
c = InStr(1, oldcode, "C")

xval = Mid(oldcode, x + 1, y - x - 2)
yval = Mid(oldcode, y + 1, i - y - 2)
ival = Mid(oldcode, i + 1, i - y - 2)
jval = Mid(oldcode, j + 1, j - i - 2)
zval = Mid(oldcode, z + 1, z - j - 2)
cval = Mid(oldcode, c + 1, 20)
cval = cval - 90

newcode = Mid(oldcode, 1, x)
newcode = newcode & yval & " Y-" & xval
newcode = newcode & " I" & jval & " J-" & ival
newcode = newcode & "Z" & zval
newcode = newcode & "C" & cval
Twister = newcode
End Function

--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email

"Dave O" wrote in message
...
One way to do it: import all the text strings into Excel, and use the
Text to Columns feature to separate each value into a separate column.
Then delete all the alpha characters: search for G, for instance, and
replace with "" which will leave only numeric characters- then you can
do the required math on them. For clarity, insert a row to contain
headers, such as G, X, Y, Z, etc.

When that's done, use columns off to the right to calculate the
converted values. Then use a CONCATENATE function to tie it all back
together: =CONCATENATE("G", a5, " ", "G", b5, " ","X",c5, " ", "Y",
d5, " ", .....etc)

Save the Excel file as a text file and the concatenated fields will be
the text string you need.

Dave O
Eschew obfuscation