How do I ask Excel to count how many items are in BOLD TYPE?
HI...wondering how I can have Excel give me a total of how many words or
titles are typed with BOLD lettering in a particular column. Can anyone help me, I'm going batty... THANKS |
There's nothing built into excel that will sum values based on formatting.
You could use a User defined function, though. Option Explicit Function CountBold(rng As Range) as Long Application.Volatile Dim myCell As Range Dim myTotal As Long myTotal = 0 For Each myCell In rng.Cells With myCell If .Font.Bold = True Then myTotal = myTotal + 1 End If End With Next myCell CountBold = myTotal End Function Be aware that changing formats won't cause excel to recalculate. You could be one calculation cycle behind. I'd hit the calculate key (F9) before I trusted the value in the cell. If you're new to macros, you may want to read David McRitchie's intro at: http://www.mvps.org/dmcritchie/excel/getstarted.htm Short course: Open your workbook. Hit alt-f11 to get to the VBE (where macros/UDF's live) hit ctrl-R to view the project explorer Find your workbook. should look like: VBAProject (yourfilename.xls) right click on the project name Insert, then Module You should see the code window pop up on the right hand side Paste the code in there. Now go back to excel. Into a test cell and type: =CountBold(a1:a10) You didn't ask, but Chip Pearson has similar routines based on colors. You may want to look at that, too: http://www.cpearson.com/excel/colors.htm Head Honcho wrote: HI...wondering how I can have Excel give me a total of how many words or titles are typed with BOLD lettering in a particular column. Can anyone help me, I'm going batty... THANKS -- Dave Peterson |
All times are GMT +1. The time now is 09:48 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com