Count if one/multiple criteria match - COUNTIF & COUNTIFS

Post Reply
wwj
Posts: 2497
Joined: 27 Jan 2007 08:16

Count if one/multiple criteria match - COUNTIF & COUNTIFS

Post by wwj »

Count if one/multiple criteria match - COUNTIF & COUNTIFS

http://office.microsoft.com/en-us/excel ... 09029.aspx
http://office.microsoft.com/en-us/excel ... 47494.aspx

Code: Select all

Example:

- Single condituion
=COUNTIF(E:E,I2)

- Multiple conditions/Criteria
=COUNTIFS(D:D,L2,E:E,"<>1")   for a value in E is not 1.

wwj
Posts: 2497
Joined: 27 Jan 2007 08:16

Re: Count if one/multiple criteria match - COUNTIF & COUNTIFS

Post by wwj »

Do not use "worksheet(..)." in front of "Range" and "Cells".

For VBA,

Code: Select all


Sheets(dataSht).Select
Sheets(dataSht).Activate
    
maxRow = Sheets(dataSht).Cells(Sheets(dataSht).Rows.Count, col4ObsData).End(xlUp).Row
numFieldData = Application.WorksheetFunction.CountIf(Range(Cells(4, col4ObsData), Cells(maxRow, col4ObsData)), "<>" & "")

Post Reply