=COUNTIF(G8:W8, cell.font.bold) Gives 0 as Result

McPhil

New Member
Joined
Aug 18, 2013
Messages
12
Hi,

I'm trying to use the COUNTIF formula as per the title and, even though I'm using Conditional Formatting to bring up bold in the cell range, I'm getting 0. (I say 'even though' as I've seen on the boards that you must use Conditional Formatting for a COUNTIF to work.)

I have a range of text in cells G2:W2 and I'm comparing the cells one by one. For example, the data is compared in G8 to G2 and, if they match, the data in G8 is formatted bold. This continues for each of the cells in the row up to W8.

I have tried a conversion of the text values (A, B, C, D) to their easy numerical counterparts (1, 2, 3, 4) to see if I could just get COUNT to work - I was getting a #VALUE error using COUNT with text - but no luck there, either: Still just 0 as the result.

I have other rows of data where I'm trying to do the same thing, i.e. G9:W9, G10:W10, G11:W11 with comparison data in G3:W3, etc, etc, but if I can get it to work in this one row, I should think that it's a small step to getting it right in the other rows.

Many thanks for the assistance
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Hi,
...I've seen on the boards that you must use Conditional Formatting for a COUNTIF to work...
Not sure what you imply here but conditional formatting can be used without COUNTIF and COUNTIF can be used without conditional formatting, one has nothing to do with the other.

...if they match, the data in G8 is formatted bold...
is the formatting done manually by the user? or it is through conditional formatting? Or is it the result of a VBA?

Re usage of 'bold' as a mean to analyses dat kindly read that thread and the posts of Jonmo1 (=IF(ISBOLD...): link to the thread.

...I have tried a conversion of the text values (A, B, C, D) to their easy numerical counterparts (1, 2, 3, 4) to see if I could just get COUNT to work - I was getting a #VALUE error using COUNT with text - but no luck there, either: Still just 0 as the result...

Use COUNTIF() it works fine with text and integers.
 
Last edited:
Upvote 0
Cheers cyrilbrd,

Not sure what you imply here but conditional formatting can be used without COUNTIF and COUNTIF can be used without conditional formatting, one has nothing to do with the other.

is the formatting done manually by the user? or it is through conditional formatting? Or is it the result of a VBA?

The notion of conditional formatting being 'necessary' popped up from a couple of Netizens asking a similar question, so I thought it might be something, but, if not, no worries.

On my sheet, though, the formatting is through conditional formatting in that, for example, cell G8 is compared to cell G2 and, if they match, G8 would take on bold for the text in the cell.

Re usage of 'bold' as a mean to analyses dat kindly read that thread and the posts of Jonmo1 (=IF(ISBOLD...): link to the thread.

Thanks for the link, but the VBA on the reply over there doesn't seem to count the instances of bold font, so it's not quite what I'm trying to put together on my sheet. Jonmo1 asks if the cells are conditionally or manually formatted, though, and that's the kind of chatter that I was seeing that lead me to believe that it might be integral to using COUNTIF for font.bold counting functions.

Use COUNTIF() it works fine with text and integers.

And that's what I've found is supposed to be the case, but, in my instance, it's only giving me 0 as the result and isn't counting anything despite the code in the title being the formula I'm using verbatim. This happens for text and integers on my sheet.

Thanks very much for the reply and I'll keep plugging away while I check back on the board for other options/ideas.

Best,

McPhil

P.S. Do you want the sheet?
 
Upvote 0

Forum statistics

Threads
1,223,895
Messages
6,175,257
Members
452,625
Latest member
saadat28

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top