I have a list that contains multiple items. However, each item has different variants.
I want to sum all occurrences of each item, regardless of the variant.
I am using the COUNTIFS function in Google Sheets but for the criteria, I want to input a range that is an array of strings.
=countifs(!A:A,("B:B"),!C:C,"small")
Where column B includes a list of different variant names and column C is sizing.
For example:
A | B | C |
---|---|---|
apples | apples | small |
apples | applez | small |
applez | applees | small |
appleees | small | |
oranges | small |
In this case I would want the result to = 4 because there were four total instances in column A where the criteria was met (using any string/row in column B) and since all sizes were small.
I was able to get the result I wanted using this formula however it is extremely cumbersome as there are many variants and they are constantly updated/changed concurrently in column B:
=countifs(A:A,"item variant 1",C:C,"small")
+countifs(A:A,"item variant 2",C:C,"small")
+countifs(A:A,"item variant 3",C:C,"small")
+countifs(A:A,"item variant 4",C:C,"small")
+countifs(A:A,"item variant 5",C:C,"small")
Seeking any improvement at all from there, I tried listing the variants within a range itself (making sure to use a semicolon for Google Sheets based on this answer) and couldn't get that to work either:
=countifs(A:A,{"item variant 1";"item variant 2";"item variant 3";"item variant 4";"item variant 5"},C:C,"small")
In the above case, it only counts instances of first variant mentioned in the range (in this case item variant 1).