[Solved] COUNTIF within an IF

Discuss the spreadsheet application
Post Reply
keithbakerlv
Posts: 11
Joined: Fri Mar 10, 2017 12:57 am

[Solved] COUNTIF within an IF

Post 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");""))
Last edited by keithbakerlv on Fri May 10, 2019 7:08 pm, edited 1 time in total.
OpenOffice 4.1.3 on Windows 10 Pro
User avatar
MrProgrammer
Moderator
Posts: 4901
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: COUNTIF within an IF

Post 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.
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
keithbakerlv
Posts: 11
Joined: Fri Mar 10, 2017 12:57 am

Re: [SOLVED] COUNTIF within an IF

Post 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.
OpenOffice 4.1.3 on Windows 10 Pro
Post Reply