Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9
Default Count cells by format

Is there a way to count/sum cells by their formatting? For example, could I
count or sum the number of cells that are "Highlighted" or that the text was
"Bold"?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 109
Default Count cells by format

Gene

You could create a function that would do what you want. For example,
to count the cells in a range that are bold, this should work

Function test(R1)
Application.Volatile

For Each cl In R1

If cl.Font.Bold = True Then
Count = Count + 1
End If

Next cl
test = Count
End Function

If on your spreadsheet you enter =test(range) in a cell, the cell value
will be the number of bold cells in the range. The
"application.volatile" causes the UDF to calculate when the worksheet
recalculates, but, simply changing the font to bold in a cell doesn't
trigger the recalc. You could change the If loop to coutn or sum
pretty much anything you want.

Good luck.

Ken
Norfolk, Va



GeneR wrote:
Is there a way to count/sum cells by their formatting? For example, could I
count or sum the number of cells that are "Highlighted" or that the text was
"Bold"?


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9
Default Count cells by format

Ken,

I certainly appreciate the help, but I think you lost me somewhere. Is
there an example or something in a little more plan language you could show
me?

" wrote:

Gene

You could create a function that would do what you want. For example,
to count the cells in a range that are bold, this should work

Function test(R1)
Application.Volatile

For Each cl In R1

If cl.Font.Bold = True Then
Count = Count + 1
End If

Next cl
test = Count
End Function

If on your spreadsheet you enter =test(range) in a cell, the cell value
will be the number of bold cells in the range. The
"application.volatile" causes the UDF to calculate when the worksheet
recalculates, but, simply changing the font to bold in a cell doesn't
trigger the recalc. You could change the If loop to coutn or sum
pretty much anything you want.

Good luck.

Ken
Norfolk, Va



GeneR wrote:
Is there a way to count/sum cells by their formatting? For example, could I
count or sum the number of cells that are "Highlighted" or that the text was
"Bold"?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Any way to count cells contining one, or more STRIKETHROUGHS? Father Guido Excel Discussion (Misc queries) 7 March 3rd 19 12:09 PM
Count Cells Mutiple Criteria kjguillermo Excel Discussion (Misc queries) 1 December 8th 06 03:41 PM
checking that cells have a value before the workbook will close kcdonaldson Excel Worksheet Functions 8 December 5th 05 04:57 PM
Can I count cells with specific format (e.g., yellow field?) umaanddottie Excel Worksheet Functions 2 May 31st 05 12:02 AM
Count Position of Filtered TEXT cells in a column Sam via OfficeKB.com Excel Worksheet Functions 8 May 18th 05 04:23 AM


All times are GMT +1. The time now is 04:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"