ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   countif cell pattern = (https://www.excelbanter.com/excel-worksheet-functions/71664-countif-cell-pattern-%3D.html)

Steve1154

countif cell pattern =
 

Hi
I need to count cells that display a pattern xlsemigray75 in a range(eg
c3:c300)
any ideas would be appreciated:rolleyes:
Steve


--
Steve1154
------------------------------------------------------------------------
Steve1154's Profile: http://www.excelforum.com/member.php...o&userid=31550
View this thread: http://www.excelforum.com/showthread...hreadid=512457


George

countif cell pattern =
 
Steve1154 wrote:
Hi
I need to count cells that display a pattern xlsemigray75 in a range(eg
c3:c300)
any ideas would be appreciated:rolleyes:
Steve


Copy this function into a module

Function countGray75(rng As Range) As Long
Dim c As Range
countGray75 = 0
For Each c In rng
If c.Interior.Pattern = xlPatternGray75 Then
countGray75 = countGray75 + 1
End If
Next
End Function

Then use the formula =countGray75(C3:C300) in your spreadsheet
Of course you can use any range

Since the custom function updates when a cell in that range has its data
modified (not it's pattern), you may need to just edit a cell in the
range of your function and just press enter. This will trigger off the
custom function to calculate.

Some strange behavior by excel;
Using format painter tool anywhere on sheet, function calculated
Using Fill color tool anywhere on sheet, function DID NOT calculate

Even making the function volatile didn't help when using the fill color
tool.

Well, i hope it helps

George

Steve1154

countif cell pattern =
 

That works a treat George. The function runs without any need for data
to be added! And with the use of custom function you have given me an
insight into solving another couple of Problems Cheers
Steve


--
Steve1154
------------------------------------------------------------------------
Steve1154's Profile: http://www.excelforum.com/member.php...o&userid=31550
View this thread: http://www.excelforum.com/showthread...hreadid=512457



All times are GMT +1. The time now is 08:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com