Removing HTML from a field

schawel

New Member
Joined
Mar 31, 2005
Messages
14
I have a massive .csv doc.

One of the columns headers in this worksheet is called 'Description'. The cell value for every row below this header is filled with HTML. Here is an example:

HTML:
<p>Some paragraph of stuff</p>
<ol>
<li>Some listing 1</li>
<li>Another listing 2</li>
</ol>

My goal is to remove all the content (HTML included) between the OL tags for each and every cell under the column 'Description' and put it directly into the cell to the right. I would call this column 'Listing'.

Macros? Formulas?
 
Last edited:

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Would this work?




=SUBSTITUTE(SUBSTITUTE(MID(A2,FIND("
  1. ",A2),FIND("
",A2)),"
  1. ",""),"
","")


EDIT: I'm having trouble posting the formula coz it contains tags, so try this and remove the spaces before each instance of "ol" or "/ol":
=SUBSTITUTE(SUBSTITUTE(MID(A2,FIND("< ol>",A2),FIND("< /ol></ ol>",A2)),"< ol>",""),"< /ol></ ol>","")
 
Last edited:
Upvote 0
Wow that worked pretty well, however, the Sub function left the code in the description area. If I move it, I also want to delete it from the Description column so I don't have redundant content.

how would I do that?

Thanks!
 
Upvote 0
Assuming the description column is A, the listing column is B, then in a third column, say column C, I'd use the following:

=SUBSTITUTE(A2,B2,"")

Drag down and fill for all rows, then simply copy column B and paste values in column B, then copy column C and paste values in column A, then delete column C.
 
Upvote 0

Forum statistics

Threads
1,223,268
Messages
6,171,100
Members
452,379
Latest member
IainTru

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top