ExcelFilter: Help me count rows where one string appears in one column and a second string appears in a second!
I have an Excel worksheet with the following setup:
Column A's contains a number of descriptions that include either string1, string2, or string3 -- a typical column A entry might be "(string1) some other text."
Column B's rows contain either StringA, StringB or StringC.
I want to write a formula that will count the number of rows where a cell in column A contains "string1" and the adjoining cell in column B contains "StringA."
The following code (from
an excel help site) would work, except String1 never appears by itself in columnA, it's always part of a larger string.
=SUMPRODUCT(--(A16:A20="string1"),--(B16:B20="stringA"))
I've tried adding wildcards, as in:
=SUMPRODUCT(--(A16:A20="*string1*"),--(B16:B20="stringA"))
but no joy.
Help?
Me, I'd use a third column to express the truth of ("string1*" adjacent to "stringA"),
=IF(AND(NOT(ISERROR(SEARCH("*cat*", B1))), C1="StringA"), 1, 0)
and sum that truth column.
I don't see how you can pass sumproduct's criterion as a closure, but it may be possible.
posted by orthogonality at 8:27 PM on August 14, 2007