ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Simple COUNTIF function help (https://www.excelbanter.com/excel-worksheet-functions/447546-simple-countif-function-help.html)

zctpec3

Simple COUNTIF function help
 
Following problem:

x 4 4
x 1 2
y 4 3
y 3 2
z 3 3

I am trying to count the number of times a value in column 2 matches the value in column 3, given a value in column 1. I.e. if column1=x, the result should be 1. if column1=y, the result should be 0, etc.

Could you please help solve this problem? I have to apply it to a spreadsheet with thousands of entries..

Thanks!

Kevin@Radstock

Hi

One way. assuming your data is in A1:C5. In E1:E3 allocate your values x, y, z. Then in F1: =SUM(IF($B$1:$B$5=$C$1:$C$5,1)*($A$1:$A$5=E1)). CSE & copy down.

Quote:

Originally Posted by zctpec3 (Post 1606965)
Following problem:

x 4 4
x 1 2
y 4 3
y 3 2
z 3 3

I am trying to count the number of times a value in column 2 matches the value in column 3, given a value in column 1. I.e. if column1=x, the result should be 1. if column1=y, the result should be 0, etc.

Could you please help solve this problem? I have to apply it to a spreadsheet with thousands of entries..

Thanks!


joeu2004[_2_]

Simple COUNTIF function help
 
"zctpec3" wrote:
Following problem:
x 4 4
x 1 2
y 4 3
y 3 2
z 3 3
I am trying to count the number of times a value in
column 2 matches the value in column 3, given a value
in column 1. I.e. if column1=x, the result should be 1.
if column1=y, the result should be 0, etc.


=SUMPRODUCT(($A$1:$A$1000="x")*($B$1:$B$1000=$C$1: $C$1000))

Of course, you can replace "x" with a reference to a cell with that value.

Spencer101

1 Attachment(s)
Quote:

Originally Posted by zctpec3 (Post 1606965)
Following problem:

x 4 4
x 1 2
y 4 3
y 3 2
z 3 3

I am trying to count the number of times a value in column 2 matches the value in column 3, given a value in column 1. I.e. if column1=x, the result should be 1. if column1=y, the result should be 0, etc.

Could you please help solve this problem? I have to apply it to a spreadsheet with thousands of entries..

Thanks!

Have a look at the attached. This is one way.

zctpec3

Quote:

Originally Posted by Spencer101 (Post 1606969)
Have a look at the attached. This is one way.

Great, thanks a lot everyone, this solved my problem!


All times are GMT +1. The time now is 05:04 AM.

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