ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Count number of times two columns have desired values (https://www.excelbanter.com/excel-discussion-misc-queries/94414-count-number-times-two-columns-have-desired-values.html)

Gavin Deveau

Count number of times two columns have desired values
 
I have two adjacent columns, one with cell values of either 20 or 40, the
other with values of "H", "R" or "D"

What I want to do is go through and compare the cells of each column, like
B1 to C1, B2 to C2 etc.

I want to count how often B# is 40 and C# is "R", B# is 40 and C# is "H" etc.

I've used countless COUNTIF statements and IF statements and COUNT
statements... I just can't seem to get a number above 1!

Ardus Petus

Count number of times two columns have desired values
 
=SUMPRODUCT((B1:B1000=40)*C1:C1000="R))

HTH
--
AP

"Gavin Deveau" a écrit dans le
message de news: ...
I have two adjacent columns, one with cell values of either 20 or 40, the
other with values of "H", "R" or "D"

What I want to do is go through and compare the cells of each column, like
B1 to C1, B2 to C2 etc.

I want to count how often B# is 40 and C# is "R", B# is 40 and C# is "H"
etc.

I've used countless COUNTIF statements and IF statements and COUNT
statements... I just can't seem to get a number above 1!




Liz

Count number of times two columns have desired values
 
PivotTable

If you've never done one, use the wizard. Drag your number column to the
top (drop column fields here), and your letter column to the left (drop row
fields here). Then drag your letter column into the center of the table
(drop data columns here), and summarize by COUNT, which it should do by
default since you're summarizing the letter column.

"Gavin Deveau" wrote in message
...
I have two adjacent columns, one with cell values of either 20 or 40, the
other with values of "H", "R" or "D"

What I want to do is go through and compare the cells of each column, like
B1 to C1, B2 to C2 etc.

I want to count how often B# is 40 and C# is "R", B# is 40 and C# is "H"
etc.

I've used countless COUNTIF statements and IF statements and COUNT
statements... I just can't seem to get a number above 1!





All times are GMT +1. The time now is 06:56 PM.

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