Count only once if either Column A or Colum B has a value

TODDLL

New Member
Joined
Apr 7, 2018
Messages
27
Office Version
  1. 365
  2. 2010
I am trying to do a count if either column A or column B in the same row has a "Y" entered. As long as either column in that row has a "Y" entered, I would like the count to equal 1, otherwise a 0. Have been trying to figure out how to use the "or" statement but have not been successful.

NameMCS Score B.AVGPCS score B.AVGCOUNT
JOEY1
SAMYY1
MIKE0
JOHNY1
JIM0
PETE0
 

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.
Probably 101 ways to do that, first 2 that come to mind

edit:- for clarity, the second formula assumes that the cells will either contain "Y" or be empty, any other content in the left column would cause a "Y" in the right column to be missed.
Book1(AutoRecovered)2 (version 1).xlsb
ABCDE
1NameMCS Score B.AVGPCS score B.AVGCOUNT
2JOEY11
3SAMYY11
4MIKE00
5JOHNY11
6JIM00
7PETE00
Sheet5
Cell Formulas
RangeFormula
D2:D7D2=--OR(B2="y",C2="y")
E2:E7E2=--(LEFT(B2&C2)="y")
 
Last edited:
Upvote 0
NameMCS Score B.AVGPCS score B.AVGCount
JOEY1
SAMYY1
MIKE0
JOHNY1
JIM0
PETE0

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    IF = Table.AddColumn(Source, "Count", each if [MCS Score B.AVG] = "Y" or [PCS score B.AVG] = "Y" then 1 else 0)
in
    IF
 
Upvote 0
Solution
Obviously I have not had any formal Excel training. This is the first time I have seen the 2 minus signs used. I had to do a search to understand their function. Thank you so much for your quick response. I am always impressed with and appreciative of the help on this site. AMAZING!
 
Upvote 0
Glad to help and thanks for the feedback :)

The double minus method is quite common once you start getting into slightly more advanced formulas, mostly with sumproduct, but it can be used anywhere that you want to convert TRUE / FALSE result to 1 or 0.

For what you asked, a better known method would be
Excel Formula:
=IF(OR(B2="Y",C2="Y"),1,0)
which would have the added advantage of being able to show anything where a Y is found such as "Ok" and "Check" instead of 1 and 0, where as the -- version can only show 1 or 0.
 
Upvote 0
Glad to help and thanks for the feedback :)

The double minus method is quite common once you start getting into slightly more advanced formulas, mostly with sumproduct, but it can be used anywhere that you want to convert TRUE / FALSE result to 1 or 0.

For what you asked, a better known method would be
Excel Formula:
=IF(OR(B2="Y",C2="Y"),1,0)
which would have the added advantage of being able to show anything where a Y is found such as "Ok" and "Check" instead of 1 and 0, where as the -- version can only show 1 or 0.

I was close but was trying to do it with a COUNTIF statement. Before I saw your first response, I did come up with something that worked. I USED a nested formula =IF(B2="Y",1,IF(C2="Y",1)). I still like your latest formula best and will use that instead. I suppose it is like you stated earlier. There a101 different ways to accomplish it. Thanks again for your support. (y)
 
Upvote 0

Forum statistics

Threads
1,214,951
Messages
6,122,449
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