Page 1 of 1

[Solved] COUNTIF within an IF

PostPosted: Fri May 10, 2019 4:04 pm
by keithbakerlv
Hi, I can't figure this formula out.
I want to put =COUNTIF(Sheet1.O17:O206; "=Y") in an IF formula that counts Sheet1.D17:D206 only if the value is "On".

Count how many times "Y" is in the cell range O12:O206 only if the cells in the range D17:D206 have the value On.

So something like =IF(Sheet1.D17:D206 = "On"; COUNTIF(Sheet1.O17:O206; "=Y");""))

Re: COUNTIF within an IF

PostPosted: Fri May 10, 2019 4:41 pm
by MrProgrammer
keithbakerlv wrote:Count how many times "Y" is in the cell range O17:O206 only if the cells in the range D17:D206 have the value On.
I believe your goal is: In rows 17 through 206 count how many have "Y" in column O and "On" in column D.
=SUMPRODUCT(O17:O206="Y";D17:D206="On")
SUMPRODUCT tutorial

If you need further assistance attach a document demonstrating the situation (remove confidential information then use Post Reply, not Quick Reply, and don't attach a picture instead of the document itself). Tell us what the correct answer for your attachment would be.

If this solved your problem please go to your first post use the Edit button and add [Solved] to the start of the title. You can select the green checkmark icon at the same time.

Re: [SOLVED] COUNTIF within an IF

PostPosted: Fri May 10, 2019 7:09 pm
by keithbakerlv
Thanks! I saw that formula in the wiki but I thought it didn't pertain to me. I see how to works now.