Reputation: 365
A B C D
1 Y Y Y "332212"
2 Y N Y "231223"
3 N Y Y "122131"
4 Y Y Y "231132"
Column A, B and C indicate whether a test was completed (Y=yes, N=no).
The test is in two-parts and column D holds the results:
I am trying to separately count the cells in column A, B and C containing a Y that:
I have the following which works, but I am curious whether there's a simpler way to accomplish the same:
=COUNTIFS(A,"=Y",D,"=22*") + COUNTIFS(A,"=Y",D,"=23*") + COUNTIFS(A,"=Y",D,"=32*")
+COUNTIFS(B,"=Y",D,"=??22*") + COUNTIFS(B,"=Y",D,"=??23*") + COUNTIFS(B,"=Y",D,"=??32*")
+COUNTIFS(C,"=Y",D,"=*22") + COUNTIFS(C,"=Y",D,"=*23") + COUNTIFS(C,"=Y",D,"=*32")
=COUNTIFS(A,"=Y",D,"=1*") + COUNTIFS(A,"=Y",D,"=?1*")
+COUNTIFS(B,"=Y",D,"=???1*") + COUNTIFS(B,"=Y",D,"=???1*")
+COUNTIFS(C,"=Y",D,"=*1") + COUNTIFS(C,"=Y",D,"=*?1")
Upvotes: 1
Views: 281
Reputation: 59475
I suggest parsing a copy of ColumnD with Text to Columns (Fixed width: "|nn|nn|nn| ) and:
in I1: =IF(AND(A1="Y",OR(E1=22,E1=23,E1=32)),1,"")
in N1: =IF(AND(A1="Y",OR(E1=11,E1=12,E1=21,E1=13,E1=31)),1,"")
each copied across two columns to the right and down to suit, then something like =SUM(I1:K4)
and =SUM(N1:P4)
.
Upvotes: 1
Reputation: 21
If I understand you question correctly, you can seperate column d using the mid function
=mid(column d, 1, 2) will give you the first two digits in column d.... =mid( column d, 2, 2) the second 2, etc.
you can count from there.
Upvotes: 2