ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Counting Variables (https://www.excelbanter.com/excel-programming/300791-counting-variables.html)

Lacy

Counting Variables
 
I have a new problem now. I need to count to see how many
of each defect I have. For example:
Count
C143 Part off pad 5/26/04 1
C201 Solder Ball 6/7/04 1
C331 Part not placed 5/24/04 3
C331 Part not placed 5/24/04
C331 Part not placed 5/24/04
C331 Part off pad 5/24/04 1

All three criteria have to match to count it. But I want a
count for each defect. Then I want a Total # of defects.

Total = 0
Count = 1
For i = 3 To RowCount
If Defect(i, 10) = Defect(, 10) Then
If Defect(i, 11) = Defect(, 11) Then
If Defect(i, 11) = Defect(, 11) Then
Count = Count + 1
End If
End If
End If
Next i
Total = Total + Count

Thanks in advance,
Lacy

Bob Phillips[_6_]

Counting Variables
 
why not use a worksheet formula

=SUMPRODUCT((A1:A25="C143")*(B1:B25="Part off
pad")*(C1:C25=(--("2004-05-26")))
etc.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Lacy" wrote in message
...
I have a new problem now. I need to count to see how many
of each defect I have. For example:
Count
C143 Part off pad 5/26/04 1
C201 Solder Ball 6/7/04 1
C331 Part not placed 5/24/04 3
C331 Part not placed 5/24/04
C331 Part not placed 5/24/04
C331 Part off pad 5/24/04 1

All three criteria have to match to count it. But I want a
count for each defect. Then I want a Total # of defects.

Total = 0
Count = 1
For i = 3 To RowCount
If Defect(i, 10) = Defect(, 10) Then
If Defect(i, 11) = Defect(, 11) Then
If Defect(i, 11) = Defect(, 11) Then
Count = Count + 1
End If
End If
End If
Next i
Total = Total + Count

Thanks in advance,
Lacy





All times are GMT +1. The time now is 08:11 AM.

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