Negative Numbers count

G

Guest

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

Thanks,
Aaron
 
B

Bob Phillips

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

--
HTH

Bob Phillips

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

Guest

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")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top