How to Extract Bold Text Only from a List in Excel


Excel is a powerful tool that offers a variety of functions for data manipulation and analysis. To extract bold text only from a list in Excel, you can use a VBA macro.

Extracting Bold Text Only from a List in Excel

Here, we will first create a formula using the VBA application and then use it to complete the task. So let us see a simple process extract bold text only from a list in Excel.

Step 1 : Consider an Excel sheet where you have a list of sentences as shown in the below image.

On current visible worksheet, right click on sheet name tab to load Sheet management menu. Select View Code, Microsoft Visual Basic for Applications window pops up.

Or, you can enter Microsoft Visual Basic for Applications window via Developer−>Visual Basic. You can also press Alt + F11 keys simultaneously to open it.

Step 2 : In Microsoft Visual Basic for Applications window, click Insert−>Module, enter below code in Module1. In this step we define a new function "ExtractBold".

Right click > View code > Insert > Module > Copy code.

Function ExtractBold(SelectRng As Range)
    If SelectRng.Font.Bold Then
        ExtractBold = SelectRng.Value
    Else
        ExtractBold = ""
    End If
End Function

Save the macro. And then quit Microsoft Visual Basic for Applications.

Step 3 : Now to extract bold text only from a list, click on an empty cell in our case cell C2 and click enter to the formula =ExtractBold(A2) to get the result.

Step 4 : Finally, to fill all the values, drag down from the first result using the auto−fill handle, and the final result will be similar to the below image.

Conclusion

To extract bold text only from a list in Excel, you can use the following VBA function. The function takes a range (SelectRng) as input and checks if the font of each cell in the range is bold. If a cell is bold, it returns the value of that cell. If not, it returns an empty string. By applying this function to the desired range, you can easily filter and extract only the bold text, which can be helpful for data analysis and manipulation purposes in Excel.

Updated on: 20-Jul-2023

926 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements