ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need help with countif or another count function (https://www.excelbanter.com/excel-programming/321271-need-help-countif-another-count-function.html)

[email protected]

Need help with countif or another count function
 
OK, I am trying to use countif, but with more that one criteria. Is
this possible.

I have rows that have a format like this:

Letter Amt Date

I need it to count how many rows have a certain letter between certain
dates? Does anybody know how to do this?


Lonnie M.

Need help with countif or another count function
 
michael, Try the followning; assuming Letter is in column 'A' and Date
is in Column 'C':

Sub LetterCount()
Dim C&, X&, cnt&
Dim myLetter As String
Dim minDate, maxDate As Date
myLetter = whatever letter
minDate = whatever date
maxDate = whatever date
C = Range(Cells(2, 1), Cells(2, 1).End(xlDown)).Rows.Count
For X = 1 To C
If Cells(X + 1, 3) = minDate Or Cells(X + 1, 3) = maxDate Then
If Cells(X + 1, 1) = myLetter Then
cnt = cnt + 1
End If
End If
Next X
MsgBox "The letter """ & myLetter & """ appears in " & cnt & " rows."
End Sub

HTH--Lonnie M.


Fredrik Wahlgren

Need help with countif or another count function
 

wrote in message
oups.com...
OK, I am trying to use countif, but with more that one criteria. Is
this possible.

I have rows that have a format like this:

Letter Amt Date

I need it to count how many rows have a certain letter between certain
dates? Does anybody know how to do this?


I have found an article that mentions countif with more than one criteria
he http://www.mrexcel.com/td0128.html
I don't know how to deal with the dates, though. It must be possible to get
date as a number, right. In that case, this article will get you started.

/Fredrik



Bob Phillips[_6_]

Need help with countif or another count function
 
Worksheet functions okay?

=SUMPRODUCT(--(A1:A1000,"A"),--(C1:C1000=--"2004-01-01"),--(C1:C1000<=--"20
04-01-20"))

--

HTH

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


wrote in message
oups.com...
OK, I am trying to use countif, but with more that one criteria. Is
this possible.

I have rows that have a format like this:

Letter Amt Date

I need it to count how many rows have a certain letter between certain
dates? Does anybody know how to do this?




Tom Ogilvy

Need help with countif or another count function
 
That formula isn't applicable in this case. It is for a range of values
within a single column. This problem involves criteria against two columns.
Countif doesn't work in that situation.

Bob Phillips has posted an Array formula (SumProduct) which does it.

--
Regards,
Tom Ogilvy

"Fredrik Wahlgren" wrote in message
...

wrote in message
oups.com...
OK, I am trying to use countif, but with more that one criteria. Is
this possible.

I have rows that have a format like this:

Letter Amt Date

I need it to count how many rows have a certain letter between certain
dates? Does anybody know how to do this?


I have found an article that mentions countif with more than one criteria
he http://www.mrexcel.com/td0128.html
I don't know how to deal with the dates, though. It must be possible to

get
date as a number, right. In that case, this article will get you started.

/Fredrik






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

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