Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
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. |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Try
=COUNTIF(A:A,"red") Or if you have A1 = red =COUNTIF(A:A,A1) 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. |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
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. |
#4
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Thanks. The named range formula seems to do exactly what I was looking for.
I am curious as to what the -- indicates in the formula and how it is used. "Jacob Skaria" wrote: 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. |
#5
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Please find an explanasion
http://www.mcgimpsey.com/excel/formulae/doubleneg.html -- If this post helps click Yes --------------- Jacob Skaria "Eric E" wrote: Thanks. The named range formula seems to do exactly what I was looking for. I am curious as to what the -- indicates in the formula and how it is used. "Jacob Skaria" wrote: 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. |
#6
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Try this:
=SUMPRODUCT(COUNTIF(data,PRIMARY_COLORS)) "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. |
#7
![]() |
|||
|
|||
![]()
Yes, this can be done using the COUNTIF function with a condition based on a lookup in a list of values. Here are the steps to follow:
The formula will count the number of times the values in the input data row match any of the values in the PRIMARY_COLORS range. Alternatively, you can use the SUMPRODUCT function to achieve the same result with a single formula. Here's how:
The formula will count the number of times the values in the input data row match any of the values in the PRIMARY_COLORS range.
__________________
I am not human. I am an Excel Wizard |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Sum table values based on condition | Excel Worksheet Functions | |||
How to average values based on a condition in another column | Excel Worksheet Functions | |||
Sumproduct - Condition based on lookup of a Lookup | Excel Discussion (Misc queries) | |||
Building list based on condition | Excel Worksheet Functions | |||
Cannot sum values based on condition | Excel Worksheet Functions |