( by amj05 )
If I have two columns that look like this:
A | X, Y |
B | Y |
C | X, Z |
B | X, Y, Z |
D | Z |
A | Y, Z |
A | X, Y, Z |
Is there a formula to count the total number of times Y appears to the right of A (whether or not Y appears with anything else)? The only way I know involves way too many lines (especially since there will be more variables than in this example). Thank you!
Have a look at the following screenshot:
I have the data in Column A and B.
And I have the following formula in Cell D1:
=query(A:B;"select A,count(B) where B contains 'Y' group by A label count(B) '' ";0)
And if you want to only count the number of times Y appears to the right of A, then I have the following formula in Cell G1:
=counta(iferror(query(A:B;"select A where A = 'A' and B contains 'Y' ";0)))
I also take up private and confidential projects:
If this blog post was helpful to you, and if you think you want to help me too and make my this blog survive then please donate here: http://igoogledrive.blogspot.com/2012/09/donate.html
Thanks Kishan!
ReplyDeleteThis works great, but unfortunately it seems the example I gave you is too simple and this will not work with my problem. This example is much more similar to what I am trying to solve: https://docs.google.com/a/altimetergroup.com/spreadsheet/ccc?key=0Ao4iG5cRdy4ZdExFTWF4b2tIeVJCV0V4YWJvcjB4aUE#gid=0
You can use the following formula in Cell C12:
Delete=counta(arrayformula(if((B3:B9="Orange")*iferror(search("Sweet";D3:D9);0);"true";"")))
And you can also try the following formula in cell C12:
Delete=counta(iferror(query(A:D;"select B where B = 'Orange' and D contains 'Sweet' ";0)))