View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default CountIf Condition based on lookup in a list of values

The below formula will return the number of primary colors in the array from
Row 1. Adjust the range to suit your requirement..

=SUMPRODUCT(--(ISNUMBER(MATCH(1:1,{"red","blue","green"},0))))

If you are using a named range replace the array with the named range

=SUMPRODUCT(--(ISNUMBER(MATCH(1:1,PRIMARY_COLORS,0))))

If this post helps click Yes
---------------
Jacob Skaria


"Eric E" wrote:

I have a row with input data: cells with values of RED, GREEN, PINK, TAN.
I have a table/range (PRIMARY_COLORS) that includes RED, BLUE, GREEN.
I would like to count the number of valid primary colors are in the input
data row.
I cannot figure out how to include a conditional statement in the COUNTIF
function: i.e., COUNTIF the cell value is a MATCH in the PRIMARY_COLORS range.

Can this be done?

Thanks.