Help with countifs to sum cells

raul8

New Member
Joined
Sep 21, 2021
Messages
36
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
  2. Web
we need help creating several formulas using the same data below:

formula 1: Count # of times when a Y appears on column B thru E on each of the 35 rows (there must be a Y in B, C, D, E) (we expect a result of 4)
Formula 2: a formula that returns a value of 0 if a cell contains a Y and value of 1 if the cell contains an N

AlvarezD_Datamanagement.xlsx
ABCDEFGHI
3STK-1STK-2STK-3STK-4STK-5STK-6STK-8STK-10
41YYYNNYNY
52YYYYYYYY
63YYYYYYYY
74YYYYYYYY
85NYNAYNYYY
96NYYYYYYY
107YYYYNYYY
118YNYYYNNY
129NYNAYNYNN
1310YYNANYYNY
1411NYNANYNNN
1512YYNAYYYYY
1613YYNYYYNN
1714YNYYYNYY
1815YYYYYYYY
1916NYYYYYYY
2017YYYYNNNY
2118NYNAYYYNY
2219NYYYNYYY
2320YNYYYYYY
2421YYYYYYNY
2522YYYYYYYY
2623YYNYYNNY
2724YYNYYYYY
2825NYNAYYNNY
2926YYNANNYYY
3027NNYYNNNN
3128NYYNYYYN
3229NYNNYYYY
3330YYYYYYYN
3431YYYYNYYY
3532YNNAYYYNN
3633YYNAYNYNY
3734YNYYYNYN
3835NYNYNYNY
Data
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B4:I38Cell Valueunique valuestextNO
I4:I38Cell Value="Y"textNO
E4:E38Cell Value="Y"textNO
H4:H38Cell Value="Y"textNO
G4:G38Cell Value="Y"textNO
F4:F38Cell Value="Y"textNO
D4:D38Cell Value="Y"textNO
C4:C38Cell Value="Y"textNO
C4:C38Cell Value="Y=0"textNO
B4:B38Cell Valuecontains "Y"textNO
B4:B38Cell Value="Y=0, N=1"textNO
B4:B38Cell Valuecontains "Y=1"textNO
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
formula 1: Count # of times when a Y appears on column B thru E on each of the 35 rows (there must be a Y in B, C, D, E) (we expect a result of 4)
How are you getting a result of 4? There are 10 rows that meet the criteria in your example.
 
Upvote 0
How are you getting a result of 4? There are 10 rows that meet the criteria in your example.
Thank you! Great catch! Yes you are right, there are 10 rows that meet the criteria
 
Upvote 0
Hi Raul8,

Formula 1 is:
Excel Formula:
=SUMPRODUCT(--($B$4:$B$38<>"")*(($B$4:$B$38="Y")*($C$4:$C$38="Y")*($D$4:$D$38="Y")*($E$4:$E$38="Y")))

...but I don't understand Formula 2? Is it just a count of all "Y"? Where does the result go?
 
Upvote 0
For the first one,
Excel Formula:
=COUNTIFS(B:B,"Y",C:C,"Y",D:D,"Y",E:E,"Y")

For the second, it is unclear if it should be a count for a specific row, column the whole range, or something else. Regardless of which is needed you can use
Excel Formula:
=COUNTIF(range,"Y")
setting range as required
 
Upvote 0
Solution
Hi Raul8,

Formula 1 is:
Excel Formula:
=SUMPRODUCT(--($B$4:$B$38<>"")*(($B$4:$B$38="Y")*($C$4:$C$38="Y")*($D$4:$D$38="Y")*($E$4:$E$38="Y")))

...but I don't understand Formula 2? Is it just a count of all "Y"? Where does the result go?
The first formula worked! Thank you, it yielded the result we expected!
 
Upvote 0
For the first one,
Excel Formula:
=COUNTIFS(B:B,"Y",C:C,"Y",D:D,"Y",E:E,"Y")

For the second, it is unclear if it should be a count for a specific row, column the whole range, or something else. Regardless of which is needed you can use
Excel Formula:
=COUNTIF(range,"Y")
setting range as required
The first formula worked! Thank you, it yielded the result we expected!
 
Upvote 0

Forum statistics

Threads
1,214,952
Messages
6,122,457
Members
449,083
Latest member
Ava19

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top