Summary

To strip HTML or other markup from values in cells, you can use the MID function. In the example shown, the formula in C5 is:

=MID(B5,4,LEN(B5)-7)

Generic formula

=MID(text,start,LEN(text)-markup_len)

Explanation 

The MID function returns characters using a fixed starting point and ending point. In this case, the markup consists of the html bold tag, which appears at the start of each cell and the associated closing tag, which appears at the end.

The MID function has been configured to always start at 4, which effectively strips the starting tag from the value. The second argument, num_chars, is calculated by getting the total characters in the cell with LEN, then subtracting 7. We use 7 because the starting bold tag is 3 characters and the closing tag is 4 characters = 7 characters total.

With these arguments, MID extracts just the text between the two tags and returns the result.

Dave Bruns Profile Picture

AuthorMicrosoft Most Valuable Professional Award

Dave Bruns

Hi - I'm Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.