There isn't a way to count based on formatting
Function CountNoStrikeThrough(r As Range) As Long
Application.Volatile
Dim c As Range, d As Long
For Each c In r
If c <> "" Then
If c.Font.Strikethrough = False Then d = d + 1
End If
Next c
CountNoStrikeThrough = d
End Function
Excel Workbook | |||||||
---|---|---|---|---|---|---|---|
A | B | C | D | E | |||
1 | * | * | * | * | 2 | ||
2 | 1 | * | * | * | * | ||
3 | 2 | * | * | * | * | ||
4 | 4 | * | * | * | * | ||
5 | 5 | * | * | * | * | ||
Sheet1 |
Of course there is, it just takes VBA.
A count of what? Just cells that don't have strikethrough in the range or what?
Of course there is, it just takes VBA.
Try this UDF:
Code:Function CountNoStrikeThrough(r As Range) As Long Application.Volatile Dim c As Range, d As Long For Each c In r If c <> "" Then If c.Font.Strikethrough = False Then d = d + 1 End If Next c CountNoStrikeThrough = d End Function
Sheet1
* A B C D E 1 * * * * 2 2 1 * * * * 3 2 * * * * 4 4 * * * * 5 5 * * * *
<COLGROUP><COL style="WIDTH: 30px; FONT-WEIGHT: bold"><COL style="WIDTH: 64px"><COL style="WIDTH: 64px"><COL style="WIDTH: 64px"><COL style="WIDTH: 64px"><COL style="WIDTH: 64px"></COLGROUP><TBODY>
</TBODY>
Spreadsheet Formulas
Cell Formula E1 =CountNoStrikeThrough(A1:A20)
<TBODY>
</TBODY>
<TBODY>
</TBODY>
Excel tables to the web >> http://www.excel-jeanie-html.de/index.php?f=1" target="_blank"> Excel Jeanie HTML 4
Right click on one of your sheet tabs and Click View Code.
This will take you into the Visual Basic Editor
From the menu on top, click on Insert, then Module.
Paste my code into the white area.
Hit Alt-q
If you are using XL2007 or higher, save the workbook as type .xlsm, otherwise .xls
Then in your worksheet, you can use the formula:
=CountNoStrikeThrough(E5:BF9)