=ARRAYFORMULA(SUM((A2:A12="a")*(B2:D12>0))

Sometimes it's easier to just work with Booleans like they're arrays of 0s and 1s.

Answer from MattKing on Stack Overflow
🌐
Statology
statology.org › home › google sheets: how to use countif with multiple ranges
Google Sheets: How to Use COUNTIF with Multiple Ranges
January 18, 2022 - Note that in this example we only used the COUNTIFS() function with two cell ranges, but we can use this function with any number of cell ranges that we’d like. How to Use COUNTIF From Another Sheet in Google Sheets How to Use MAXIFS in Google Sheets How to Calculate Frequencies in Google Sheets How to Normalize Data in Google Sheets
Discussions

google sheets - How can I refer to two different columns in a COUNTIF function? - Web Applications Stack Exchange
Google Sheets now includes the COUNTIFS function which can directly handle the required job. ... You can include as many criteria_range, criterion pairs as you need. More on webapps.stackexchange.com
🌐 webapps.stackexchange.com
January 16, 2012
Countif function for multiple ranges that are in different rows. - Google Docs Editors Community
Skip to main content · Google Docs Editors Help · Sign in · Google Help · Help Center · Community · Google Docs Editors · Terms of Service · Submit feedback · Send feedback on More on support.google.com
🌐 support.google.com
Google Sheet formula, need answer fast: countif (or countifs) on a sheet, multiple ranges but same criteria - Factual Questions - Straight Dope Message Board
Hi, I’ve tried searching for this but can’t seem to find the answer. In one cell I want to count the number of cells containing “A” but there are two separate ranges to look for those As. What’s the formula for this? I tried this but no joy – =countifs(A1:V11,“A”,A12:T58,“A”) ... More on boards.straightdope.com
🌐 boards.straightdope.com
0
December 8, 2022
COUNTIF with multiple ranges in the same column - Google Docs Editors Community
Skip to main content · Google Docs Editors Help · Sign in · Google Help · Help Center · Community · Google Docs Editors · Terms of Service · Submit feedback · Send feedback on More on support.google.com
🌐 support.google.com
January 11, 2021
🌐
Google Support
support.google.com › docs › answer › 3256550
COUNTIFS - Google Docs Editors Help
Returns the count of a range depending ... additional ranges must contain the same number of rows and columns as criteria_range1. COUNTIF: Returns a conditional count across a range....
🌐
Coupler.io Blog
blog.coupler.io › home › when to use countif or countifs in google sheets: real-life formula examples
COUNTIF vs. COUNTIFS in Google Sheets | Coupler.io Blog
August 5, 2025 - Count the values that meet all ... criteria. To check multiple criteria in the same column range, you need to use ARRAYFORMULA + SUM + COUNTIFS and place your criteria in the curly braces...
🌐
Layer
golayer.io › home › countif & countifs in google sheets: formula & examples
COUNTIF & COUNTIFS in Google Sheets: Formula & Examples | Layer Blog
July 17, 2024 - Google Sheets has built-in functions to save you the trouble: COUNTIF and COUNTIFS. The first allows you to specify a range of cells and the criterion that cells must meet to be counted. COUNTIFS, however, allows you to specify multiple ranges and multiple criteria.
Top answer
1 of 6
10

Use a combination of the ARRAYFORMULA, SUM and arithmetic operations

Use the approach provided in barry houdini's answer. To count all of the clicks by a 26 year old:

=ARRAYFORMULA(sum((A:A=26) * (C:C="true")))

There are 3 parts to this operation.

  • The ARRAYFORMULA takes care of looping over the specified range
  • The SUM manages counting all of the true results

Essentially, true is being converted to 1 and false is being converted to 0. Boolean logic is done by using arithmetic operations.

An AND operation uses multiplication:

  • (1 * 1) = 1 - (True && True) = True
  • (1 * 0) = 0 - (True && False) = False
  • (0 * 0) = 0 - (False && False) = False

An OR operation uses a combination of the *SIGN function and addition:

  • sign(1 + 1) = 1 - (True || True) = True
  • sign(1 + 0) = 1 - (True || False) = True
  • sign(0 + 0) = 0 - (False || False) = False

Note: The sign function is necessary because of the way boolean addition works differently than arithmetic addition. Basically in boolean addition 1 + 1 = 1, in arithmetic addition 1 + 1 = 2. Obviously, arithmetic addition will mess up the count so you need to run the results of the addition operations through a sign function. The sign function returns 1 if the value is positive, 0 if the value is 0, and -1 if the value is negative.

Lets say you wanted to count the clicks for all users between age 20-25:

=ARRAYFORMULA(sum(sign((A:A=20) + (A:A=21) + (A:A=22) + (A:A=23) + (A:A=24) + (A:A=25)) * (C:C="true")))
2 of 6
18

Google Sheets now includes the COUNTIFS function which can directly handle the required job.

=COUNTIFS(A:A, E2, C:C, true)

Syntax

=COUNTIFS(
  criteria_range1, criterion1,
  [criteria_range2, criterion2, 
  ...])

You can include as many criteria_range, criterion pairs as you need.

Find elsewhere
🌐
Ablebits
ablebits.com › ablebits blog › google sheets tips › google sheets functions › google spreadsheet countif function with formula examples
Google Spreadsheet COUNTIF function with formula examples
So if they have their name in row 1,3 and 5 it will add up D in sheets 2? ... If I understand your task correctly, you can use QUERY just like in this article or the Combine Duplicate Rows add-on described there at the end. NAEEM..... 2024-02-04 · plz helpmme out for this...... =COUNTIFS(C14:C44,">=350000",C14:C44,"=350000",C14:C44,"=400000",C14:C44,"<450000")*150 it not working ... It seems like you want to count the number of cells in the range C14:C44 that meet multiple conditions and then multiply that count by 150.
Published: August 16, 2021
Views: 45
🌐
Google Support
support.google.com › docs › thread › 226385501 › countif-function-for-multiple-ranges-that-are-in-different-rows
Countif function for multiple ranges that are in different rows. - Google Docs Editors Community
Skip to main content · Google Docs Editors Help · Sign in · Google Help · Help Center · Community · Google Docs Editors · Terms of Service · Submit feedback · Send feedback on
🌐
LiveFlow
liveflow.com › product-guides › how-to-use-countif-function-in-google-sheets
How to Use COUNTIF Function in Google Sheets | LiveFlow
For instance, if you want to count ... up the results from two separate COUNTIF formulas like “=COUNTIF(range C, criterion A)+COUNTIF(range C, criterion B)”....
🌐
Straight Dope Message Board
boards.straightdope.com › factual questions
Google Sheet formula, need answer fast: countif (or countifs) on a sheet, multiple ranges but same criteria - Factual Questions - Straight Dope Message Board
December 8, 2022 - Hi, I’ve tried searching for this but can’t seem to find the answer. In one cell I want to count the number of cells containing “A” but there are two separate ranges to look for those As. What’s the formula for this? I tried this but no joy – =countifs(A1:V11,“A”,A12:T58,“A”) I get #REF!
🌐
Google Support
support.google.com › docs › thread › 63694012 › countif-with-multiple-ranges-in-the-same-column
COUNTIF with multiple ranges in the same column - Google Docs Editors Community
January 11, 2021 - Skip to main content · Google Docs Editors Help · Sign in · Google Help · Help Center · Community · Google Docs Editors · Terms of Service · Submit feedback · Send feedback on
🌐
Coefficient
coefficient.io › home
How to Use The COUNTIF Google Sheets Function - Coefficient
September 2, 2025 - Get started by pulling live data into pre-built Sheets dashboards. ... Apply the syntax: =COUNTIF(range, criteria) where range is your cell range and criteria is your condition ... Leverage wildcards like * (matches multiple characters) and ?
🌐
Ben Collins
benlcollins.com › home › google sheets countifs function
Google Sheets COUNTIFS Function -
February 25, 2022 - The Google Sheets COUNTIFS function is used to count items in ranges with multiple test criteria.
🌐
ExcelDemy
exceldemy.com › home › excel formulas › apply countif function in multiple ranges for same criteria
Apply COUNTIF Function in Multiple Ranges for Same Criteria - ExcelDemy
June 13, 2024 - Input the following formula in a selected cell to count the cells with same criteria in multiple ranges. =COUNTIF(C5:C9,"<1/1/1995")+COUNTIF(E5:E9,"<1/1/1995")
🌐
Magoosh
magoosh.com › excel › how-to-handle-countif-multiple-criteria-in-excel
Magoosh | Online Test Prep
August 12, 2025 - I found the entire experience to be extremely satisfying not only due to the informative video lessons and well-explained practice questions, but also because I could track my progress whenever I practiced questions. I had devoted only one month to prep for GREs, so it was important to know how much I progressed each day, and Magoosh helped me by showing me my score range for both sections.
🌐
Twistedwick
store.twistedwick.com › cache › 70g1b › article.php
google sheets countif multiple ranges
Generic formula : =COUNTIFS(range,">=X",range,"<=Y") Countif across Multiple Worksheets. If a number is provided, each cell in range is checked for equality with criterion. Yellow is not case-sensitive so this is going to pick up three instances even though B7 is not capitalized.
🌐
Got It AI
got-it.ai › solutions › excel-chat › excel-tutorial › countif › how-to-use-a-countif-function-in-google-spreadsheets
Learn How to Use COUNTIF Function in Google Sheets - Excelchat
February 13, 2023 - Keep your cursor in a cell where you want to show your calculations, like cell E1 · Enter “=” sign and type COUNTIF function in this active cell E1, an auto-suggested box pops up · Select the range of cells which you want to text again ...