Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() Dave Peterson Wrote: Do you mean VBA or VB? In a cell in a worksheet, I'd use: =sum(countif(a:a,{"ok","ca","ng"}) In VBA, I'd use: Option Explicit Sub testme() Dim myStr As Variant Dim myTotal As Long Dim iCtr As Long Dim myRng As Range Set myRng = ActiveSheet.Range("a:a") myStr = Array("ok", "ca", "ng") myTotal = 0 For iCtr = LBound(myStr) To UBound(myStr) myTotal = myTotal + Application.CountIf(myRng, myStr(iCtr)) Next iCtr MsgBox myTotal End Sub jmoss wrote:- How can I count the number of times "OK" or "CA" or "NG" occur in a column using VB? If the count of "NG" is equal to or greater than 20, then don't print the worksheet. -- jmoss- -- Dave Peterson Thanks for the code, this solved my problem! This is a great forum. -- jmoss |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can't find topic for count | Excel Discussion (Misc queries) | |||
UDF is updateing cells on another sheet with count from current sheet. | Excel Discussion (Misc queries) | |||
How do i count numbers and letters to find a total count of all | Excel Worksheet Functions | |||
SUMPRODUCT Formula to Count Row of data Below Matched Criteria | Excel Worksheet Functions | |||
Find Count of Items with certain criteria | Excel Discussion (Misc queries) |