View Single Post
  #17   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Glenn Glenn is offline
external usenet poster
 
Posts: 1,240
Default With a Function, how can I get rid of formating codes like <div?

AFSSkier wrote:
I have a refreshable spreadsheet with data imported from Access. When the
data imports, I get Access formatting codes like <div, &nbsp and font codes
(see below). I doing want the end user to have to do a search & replace a
blank, even with a macro. It only happens with memo/comment fields coming
from Access.

<div<font face=Arial size=2 color="#006666"PBA data. (ALL VERSIONS
INCLUDING MONTANA)</font</div <div </div

In an adjacent cell I want to use a function(s) to format the new cell to
look like this = PBA data. ;(ALL VERSIONS INCLUDING MONTANA)



Try this:

=TRIM(RIGHT(SUBSTITUTE(LEFT(A1,FIND("</",A1)-1),"",REPT(" ",9999)),9999))

Makes the assumption that your actual data is all in one chunk and will always
start after a "" and end before the first "</". If that's not always true, or
if there is "" or "</" within your data, then you will need to pursue more
complex solutions.