Dataset Overview
Let’s assume we have a concise dataset with approximately 7 rows and 2 columns. Initially, all cells are in the General format, and monetary values are in Accounting format. The dataset contains two unique columns: Item and Price. If needed, we can adjust the number of columns later.
Step 1 – Opening Find & Select Option
- Go to the Home tab.
- Click on Find & Select under the Editing section.
- Choose Replace.
Read More: Count Text at Start with COUNTIF & LEFT Functions in Excel
Step 2 – Inserting Data
- In the Find and Replace window, click the Format drop-down next to the Find what option.
- Select Choose Format From Cell.
- Click on any bold cell that you want to count.
- You’ll see a preview of what to find; enter bold in the Replace with field.
- Click Replace All.
Step 3 – Applying the COUNTIF Function
- After completing the previous step, the bold cells will be replaced with the text bold.
- Go to cell C11.
- Type the following formula:
=COUNTIF(C5:C10,"bold")
- Press Enter to calculate the number of bold cells in the dataset.
Read More: [Fixed] COUNTIF Function with Wildcard Not Working in Excel
How to Count Bold Cells Using VBA in Excel
- Go to the Developer tab.
- Select Visual Basic.
- Click Insert in the VBA window and choose Module.
- Enter the following formula in the new window:
Function CountIfBold(SelectRange As Range)
Dim CurrentRange As Range
Dim BoldCount As Double
For Each CurrentRange In SelectRange
If CurrentRange.Font.Bold Then
BoldCount = BoldCount + 1
End If
Next
CountIfBold = BoldCount
End Function
- In cell C11, insert this formula:
=CountIfBold(C5:C10)
- Press Enter to calculate the number of bold cells.
Read More: [Solved!]: Excel COUNTIF Returning 0 Instead of Actual Value
Counting Colored Cells in Excel
- Navigate to the Home tab.
- Click on Find & Select under Editing.
- Choose Replace.
- In the Find and Replace window, click Options.
- Click the Format drop-down next to the Find what field and select Choose Format From Cell.
- Click on any of the cells with the fill color that you want to count.
- Enter the word colored in the Replace with field.
- Click Replace All.
- In cell C11, use this formula:
=COUNTIF(C5:C10,"colored")
- Press Enter to get the number of cells with fill color.
Read More: How to Use COUNTIF Function to Count Text from List in Excel
Download Practice Workbook
You can download the practice workbook from here.
Related Articles
<< Go Back to Excel COUNTIF Function | Excel Functions | Learn Excel
Get FREE Advanced Excel Exercises with Solutions!