using a cell content as a string with COUNTIF
column A contains cells with each a different list of products
ex: A1 = carrots, broccoli, potatoes
A2 = carrots, chives, garlic
A3 = broccoli, garlic, tomatoes
column B contains the list of individual products
B1 = carrots
B2 = broccoli
B3 = tomatoes
I want column C to return the number of occurences in the column A of each product from column B
with the exemple above, C1 should be 2, C2, 2 and C3, 1
the problem is the string in COUNTIF needs wildcards
=COUNTIF(A1:A3;C1) returns 0
however if I use COUNTIF(A1:A3;"*brocoli*") etc it works.
There's a workaround: if I write products in column B with wildcards
B1 = *carrots*
B2 = *broccoli*
B3 = *tomatoes*
it works, but is there a way I can keep the "clean" product names in column B but treat the strings with wildcards?
Last edited by geoffm; 08-16-2011 at 11:58 AM.
Reason: solved
|