• Status: Solved
• Priority: Medium
• Security: Public
• Views: 167

# Formula help

Hello,

Can someone please explain to me how I would get the following?

On the attached spreadsheet I have some data that I would like to add together.
I would like to count for example both column A and column H as one if they both say “Yes”
Would this be an IF statement?
example.xlsx
0
vegas86
• 2
• 2
• 2
• +1
1 Solution

Microsoft MVP ExcelCommented:
Hello,

if you want to return a 1 if both column A and H in a given row equals Yes, then use in row 2

=IF(AND(A2="yes",H2="yes"),1,0)

copy down.

cheers, teylyn
0

Author Commented:
Hey Teylyn,

Sorry I worded that wrong. What you did is perfect but is there any chance i can do the entire columns at once? so count how many rows that have yes is both columns A and H and return a number?
0

Commented:
... or, if you're trying to count Yes's but treat A and H as one then...

=COUNTIF(A2:M2,"Yes")-AND(A2="Yes",H2="Yes")

Regards,
Brian.
example-V3.xlsx
0

Sr. System AnalystCommented:
N1: BothYes
N2: =IF(AND(A2="Yes", H2="Yes"),1,0)
Copy down

O1:Total
O2:==SUM(N:N)

you can hide column N if you wish
0

Sr. System AnalystCommented:
here how it works...
example.xlsx
0

Microsoft MVP ExcelCommented:
You can use countifs()

=COUNTIFS(A:A,"yes",H:H,"yes")

cheers, teylyn
0

Author Commented:
Thanks for all your help and suggestions guys. Thank you Teylyn the countif was exactly what i needed!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

## Featured Post

• 2
• 2
• 2
• +1
Tackle projects and never again get stuck behind a technical roadblock.