by Allen Wyatt
(last updated February 1, 2020)
Ken wonders if there is a worksheet function that will indicate whether the contents of a cell are bold. He can find other informational functions, such as ISBLANK, but cannot find one that will indicate if the cell is bold.
There is no ISBOLD function built into Excel. There is a very arcane way to do this without resorting to a macro, but it only works with some versions of Excel. Apparently, for example, this approach won't work with Office 365, as it appears that Microsoft has finally removed support for it. This old Excel 4 function, called GET.CELL, will work with some older versions of Excel. Here is how you would use it in a formula:
=IF(GET.CELL(20,A1), "Bold", "Not Bold")
The GET.CELL function returns True if at least the first character in the cell is bold.
A better approach would be to create a User-Defined Function in VBA that could be called from your worksheet. Here's a simple version of such a UDF:
Function CheckBold(cell As Range) As Boolean Application.Volatile CheckBold = cell.Font.Bold End Function
In order to use it in your worksheet, you would do so in this manner:
=IF(CheckBold(A1), "Bold", "Not Bold")
The CheckBold function will only update when your worksheet is recalculated, not if you simply apply bold formatting to or remove it from cell A1.
This approach can work for most instances but understand that the Bold property can actually have three possible settings—True, False, and Null. The property is set to False if none of the characters in the cell are bold. It is set to True if they are all bold. Finally, it is set to Null if only some of the characters in the cell are bold. If you think you might run into this situation, then you'll need to modify the CheckBold function:
Function CheckBold(cell As Range) As Integer Dim iBold As Integer Application.Volatile iBold = 0 If IsNull(cell.Font.Bold) Then iBold = 2 Else If cell.Font.Bold Then iBold = 1 End If CheckBold = iBold End Function
Note that the function now returns a value, 0 through 2. If it returns 0, there is no bold in the cell. If it returns 1, then the entire cell is bold. If it returns 2, then there is partial bold in the cell.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (13733) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Office 365.
Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!
What are you to do if you are trying to format a worksheet, only to find out that one of the tools you need is not ...Discover More
If you need to change the color with which a particular cell is filled, the easier method is to use the Fill Color tool, ...Discover More
One way you can format a cell is so that its contents are repeated over and over again for the entire width of the cell. ...Discover More
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.