ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Negative Numbers count (https://www.excelbanter.com/excel-programming/377535-negative-numbers-count.html)

Aaron

Negative Numbers count
 
I am looking for code that would count all the negative numbers in a column
and msgbox the results.

Thanks,
Aaron

Bob Phillips

Negative Numbers count
 
Msgbox Application.COUNTIF(Range(A:A),"<0")

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Aaron" wrote in message
...
I am looking for code that would count all the negative numbers in a

column
and msgbox the results.

Thanks,
Aaron




Aaron

Negative Numbers count
 
What if I wanted to count two different tabs and report both results in one
msgbox?

"Bob Phillips" wrote:

Msgbox Application.COUNTIF(Range(A:A),"<0")

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Aaron" wrote in message
...
I am looking for code that would count all the negative numbers in a

column
and msgbox the results.

Thanks,
Aaron





Jim Thomlinson

Negative Numbers count
 
Something like this...

MsgBox Application.CountIf(Sheets("Sheet1").Range("A:A"), "<0") + _
Application.CountIf(Sheets("Sheet2").Range("B:B"), "<0")

or this...

MsgBox Application.CountIf(Sheets("Sheet1").Range("A:A"), "<0") & vbcrlf
& _
Application.CountIf(Sheets("Sheet2").Range("B:B"), "<0")

--
HTH...

Jim Thomlinson


"Aaron" wrote:

What if I wanted to count two different tabs and report both results in one
msgbox?

"Bob Phillips" wrote:

Msgbox Application.COUNTIF(Range(A:A),"<0")

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Aaron" wrote in message
...
I am looking for code that would count all the negative numbers in a

column
and msgbox the results.

Thanks,
Aaron






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

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