ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   can you use countif function for noncontiguous cells (https://www.excelbanter.com/excel-worksheet-functions/55276-can-you-use-countif-function-noncontiguous-cells.html)

rutledbr

can you use countif function for noncontiguous cells
 
I am trying to use the countif function to add the appearance of value in
cells that are not adjacent to each other. Specifically I have two cells that
pertain to the same question. For each question I want to compile the
occurence of certain value therefore I want to use the countif function on
every second column.

Bob Phillips

can you use countif function for noncontiguous cells
 
Not countif, but you can do it

=SUMPRODUCT(--(A1:M1="value),--(MOD(COLUMN(A1:M1),2)=0)

which will count B, D, etc. if they equal the required value

--

HTH

RP
(remove nothere from the email address if mailing direct)


"rutledbr" wrote in message
...
I am trying to use the countif function to add the appearance of value in
cells that are not adjacent to each other. Specifically I have two cells

that
pertain to the same question. For each question I want to compile the
occurence of certain value therefore I want to use the countif function on
every second column.




Peo Sjoblom

can you use countif function for noncontiguous cells
 
One way

=SUMPRODUCT((MOD(COLUMN(A2:O2),2)=1)*(A2:O2="A"))

will count A in A2:O2 in A, C, E etc

--
Regards,

Peo Sjoblom

(No private emails please)


"rutledbr" wrote in message
...
I am trying to use the countif function to add the appearance of value in
cells that are not adjacent to each other. Specifically I have two cells
that
pertain to the same question. For each question I want to compile the
occurence of certain value therefore I want to use the countif function on
every second column.




All times are GMT +1. The time now is 03:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com