ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Count number of cells in a range with amount 0 (https://www.excelbanter.com/excel-programming/334282-count-number-cells-range-amount-0-a.html)

mikeburg[_6_]

Count number of cells in a range with amount 0
 

What would be the simplest code to get a count of the number of cells in
a range F4:F63 that contains an amount greater then zero?

Thanks so much.

mikeburg


--
mikeburg
------------------------------------------------------------------------
mikeburg's Profile: http://www.excelforum.com/member.php...o&userid=24581
View this thread: http://www.excelforum.com/showthread...hreadid=386450


Bob Phillips[_6_]

Count number of cells in a range with amount 0
 
=COUNTIF(F4:F643,"0")

--

HTH

RP
(remove nothere from the email address if mailing direct)


"mikeburg" wrote in
message ...

What would be the simplest code to get a count of the number of cells in
a range F4:F63 that contains an amount greater then zero?

Thanks so much.

mikeburg


--
mikeburg
------------------------------------------------------------------------
mikeburg's Profile:

http://www.excelforum.com/member.php...o&userid=24581
View this thread: http://www.excelforum.com/showthread...hreadid=386450




David Jessop

Count number of cells in a range with amount 0
 
Hi,

Try

=COUNTIF(F4:F63,"0")

HTH,

David Jessop

"mikeburg" wrote:


What would be the simplest code to get a count of the number of cells in
a range F4:F63 that contains an amount greater then zero?

Thanks so much.

mikeburg


--
mikeburg
------------------------------------------------------------------------
mikeburg's Profile: http://www.excelforum.com/member.php...o&userid=24581
View this thread: http://www.excelforum.com/showthread...hreadid=386450



Bernie Deitrick

Count number of cells in a range with amount 0
 
Mike,

Dim i As Integer
i = Application.WorksheetFunction.CountIf(Worksheets(" Sheet1").Range("F4:F63"), "0")
MsgBox i

or you can leave out the worksheetfunction part, and the variable:

MsgBox Application.CountIf(Worksheets("Sheet1").Range("F4 :F63"), "0")


HTH,
Bernie
MS Excel MVP


"mikeburg" wrote in message
...

What would be the simplest code to get a count of the number of cells in
a range F4:F63 that contains an amount greater then zero?

Thanks so much.

mikeburg


--
mikeburg
------------------------------------------------------------------------
mikeburg's Profile: http://www.excelforum.com/member.php...o&userid=24581
View this thread: http://www.excelforum.com/showthread...hreadid=386450




mikeburg[_7_]

Count number of cells in a range with amount 0
 

Works great, Bernie, for one worksheet.

However, I have another that I need to count, if range F4:F63 contain
an amount greater than zero AND if the corresponding row of G4:G6
contains a text string.

Any ideas?

In other words I need a count of the rows whose cells F4:F63 ar
greater than zero AND whose cells G4:g63 contains text too.

I am new to VBA, so I really appreciate everyone helping me out.
learn a lot from this!

mikebur

--
mikebur
-----------------------------------------------------------------------
mikeburg's Profile: http://www.excelforum.com/member.php...fo&userid=2458
View this thread: http://www.excelforum.com/showthread.php?threadid=38645


Bob Phillips[_6_]

Count number of cells in a range with amount 0
 
=SUMPRODUCT(--(F4:F630),--(NOT(ISNUMBER(G4:G63))))

--

HTH

RP
(remove nothere from the email address if mailing direct)


"mikeburg" wrote in
message ...

Works great, Bernie, for one worksheet.

However, I have another that I need to count, if range F4:F63 contains
an amount greater than zero AND if the corresponding row of G4:G63
contains a text string.

Any ideas?

In other words I need a count of the rows whose cells F4:F63 are
greater than zero AND whose cells G4:g63 contains text too.

I am new to VBA, so I really appreciate everyone helping me out. I
learn a lot from this!

mikeburg


--
mikeburg
------------------------------------------------------------------------
mikeburg's Profile:

http://www.excelforum.com/member.php...o&userid=24581
View this thread: http://www.excelforum.com/showthread...hreadid=386450




Bernie Deitrick

Count number of cells in a range with amount 0
 
Mike,

In VBA, you could use

Dim i As Integer
i = Application.Evaluate("SumProduct((F4:F63 0)* IsText(G4:G63))")
MsgBox i

HTH,
Bernie
MS Excel MVP


"mikeburg" wrote in message
...

Works great, Bernie, for one worksheet.

However, I have another that I need to count, if range F4:F63 contains
an amount greater than zero AND if the corresponding row of G4:G63
contains a text string.

Any ideas?

In other words I need a count of the rows whose cells F4:F63 are
greater than zero AND whose cells G4:g63 contains text too.

I am new to VBA, so I really appreciate everyone helping me out. I
learn a lot from this!

mikeburg


--
mikeburg
------------------------------------------------------------------------
mikeburg's Profile: http://www.excelforum.com/member.php...o&userid=24581
View this thread: http://www.excelforum.com/showthread...hreadid=386450




mikeburg[_8_]

Count number of cells in a range with amount 0
 

Works great Bernie!

Thanks a million,

mikeburg


--
mikeburg
------------------------------------------------------------------------
mikeburg's Profile: http://www.excelforum.com/member.php...o&userid=24581
View this thread: http://www.excelforum.com/showthread...hreadid=386450



All times are GMT +1. The time now is 12:45 PM.

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