IF - AND - OR statement?

D

duketter

Using Excel 2007. I have four cells that either contain a "Y" or are blank.
I am trying to analyze if any two of the four cells in A1:A4 have a "Y" then
in cell A6 there should be a Y. If only one of the four cells has a "Y" then
cell A6 should be blank.

I have tried this formula but it only takes into account the first cell in
A1: =IF(AND(A1="Y",OR(A2="Y", A3="Y",A4="Y")),"Y","N") I need it to look at
all the cells and if any two have a "Y" then a "Y" is entered in A6.
 
J

Joe User

duketter said:
if any two of the four cells in A1:A4 have a
"Y" then in cell A6 there should be a Y. If
only one of the four cells has a "Y" then
cell A6 should be blank.

In A6:

=if(countif(A1:A4,"Y")=2, "Y", "")

Change "=2" to ">=2" if you meant to say if __at_least__ 2 cells have "Y".


----- original message -----
 
G

Glenn

duketter said:
Using Excel 2007. I have four cells that either contain a "Y" or are blank.
I am trying to analyze if any two of the four cells in A1:A4 have a "Y" then
in cell A6 there should be a Y. If only one of the four cells has a "Y" then
cell A6 should be blank.

I have tried this formula but it only takes into account the first cell in
A1: =IF(AND(A1="Y",OR(A2="Y", A3="Y",A4="Y")),"Y","N") I need it to look at
all the cells and if any two have a "Y" then a "Y" is entered in A6.

=IF(COUNTIF(A1:A4,"Y")=2,"Y","N")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top