ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   counting a range that has only general format (https://www.excelbanter.com/excel-discussion-misc-queries/259998-counting-range-has-only-general-format.html)

E[_2_]

counting a range that has only general format
 
I'm attempting to count cells in a range that have a general format. Need
help with countif.
--
1 putt

Mike H

counting a range that has only general format
 
Hi,

AFAIK that can't be done with countif. How about a UDF.

Alt +F11 to open VB editor. Right click 'ThisWorkbook' and insert module and
paste the code beolw in

call with

=CountGeneral(A!:A10)


Function CountGeneral(rng As Range) As Long
For Each c In rng
If c.NumberFormat = "General" Then
CountGeneral = CountGeneral + 1
End If
Next
End Function
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"E" wrote:

I'm attempting to count cells in a range that have a general format. Need
help with countif.
--
1 putt



All times are GMT +1. The time now is 01:34 AM.

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