=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
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.

Discussions

COUNTIFS On Separate Ranges - 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
November 19, 2020
I want to use countif for multiple columns at once
nvm solved it More on reddit.com
🌐 r/googlesheets
4
2
August 26, 2023
How to set up COUNTIFS with multiple criteria. - 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 19, 2023
Using COUNTIF with multiple criteria.
Some functions don’t work with ARRAYFORMULA() let’s try MAP() =SUM(MAP(Master!B2:B100, Master!C2:C100, LAMBDA(t,r,N(AND(t=“Instrument”,r=“Pass”))))) More on reddit.com
🌐 r/sheets
17
4
May 2, 2024
People also ask

How can I count unique values with multiple criteria using COUNTIF in Google Sheets?
To count unique values with multiple criteria, combine COUNTIF with ARRAYFORMULA and UNIQUE: COUNTIF(ARRAYFORMULA(UNIQUE(range1)), criterion1). This counts unique values meeting specific conditions in range1.
🌐
owox.com
owox.com › blog › articles › google sheets tips › how to master countif and countifs in google sheets
How to Master COUNTIF and COUNTIFS in Google Sheets
What is the syntax of the COUNTIF function in Google Sheets?
The syntax of COUNTIF in Google Sheets is COUNTIF(range, criterion). Specify range as the cells to evaluate and criterion as the condition or pattern to count. Example: COUNTIF(A1:A10, ">10") counts cells in A1 greater than 10.
🌐
owox.com
owox.com › blog › articles › google sheets tips › how to master countif and countifs in google sheets
How to Master COUNTIF and COUNTIFS in Google Sheets
How can I count cells with specific text using COUNTIF in Google Sheets?
To count cells with specific text, use COUNTIF(range, "text"). Example: COUNTIF(A1:A10, "apple") counts cells in A1 containing "apple". Use wildcards like * for partial matches (COUNTIF(A1:A10, "*apple*")).
🌐
owox.com
owox.com › blog › articles › google sheets tips › how to master countif and countifs in google sheets
How to Master COUNTIF and COUNTIFS in Google Sheets
🌐
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 - =COUNTIFS(‘All orders’!F:F,”Mark ... criteria in the same column range, you need to use ARRAYFORMULA + SUM + COUNTIFS and place your criteria in the curly braces as follows:...
🌐
Google Support
support.google.com › docs › thread › 84063700 › countifs-on-separate-ranges
COUNTIFS On Separate Ranges - Google Docs Editors Community
November 19, 2020 - 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
🌐
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
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. Your formula has a small logical issue because it combines conditions using AND logic, and as a result, it's unlikely that a single cell will meet all those conditions simultaneously. If you want to count cells that meet any of the specified conditions, you should use the OR logic instead. ... We are using a google sheet to check in students. From this sheet I have columns for the following: Wait Time, Check in Time, Student First Name, who they need to see with a drop down of choices, Staff initial for check in, meeting type (drop down), mode (In-person, Zoom, Phone, or email drop down), staff initial when meeting is done, end time, and total time.
Published: August 16, 2021
Views: 45
🌐
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 - The COUNTIFS() function in Google Sheets can be used to count the number of rows in a spreadsheet that meet multiple criteria.
Find elsewhere
🌐
InfoInspired
infoinspired.com › home › google docs › spreadsheet › countifs with multiple criteria in same range in google sheets
COUNTIFS with Multiple Criteria in Same Range in Google Sheets
2 weeks ago - However, sometimes conditions need to be tested in the same column along with conditions in other columns. The following syntax clearly specifies “criterion1”, “criterion2” in separate ranges, not “criterion1”, “criterion2”, … in the same range (criteria_range1): COUNTIFS(criteria_range1, criterion1, [criteria_range2, …], [criterion2, …]) This tutorial will guide you on the proper way to use multiple criteria in the same range in COUNTIFS in Google Sheets.
🌐
Spreadsheet Point
spreadsheetpoint.com › home › formula posts › how to use the countifs google sheets function
How to Use the COUNTIFS Google Sheets Function
February 16, 2024 - You will get the correct results for the items sold Online worth less than 600 in your second sheet. The COUNTIFS function in Google Sheets lets you count the number of cells in a given range based on multiple criteria in multiple columns.
🌐
Owox
owox.com › blog › articles › google sheets tips › how to master countif and countifs in google sheets
How to Master COUNTIF and COUNTIFS in Google Sheets
June 1, 2026 - This method is helpful for filtering and counting specific data based on multiple criteria within the same or different columns. You can use the COUNTIFS function across different sheets in Google Sheets to count data that meets certain conditions.
🌐
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.
🌐
Google Support
support.google.com › docs › answer › 3256550
COUNTIFS - Google Docs Editors Help
Returns the count of a range depending on multiple criteria. ... criteria_range2, criterion2... - [ OPTIONAL ] - Additional ranges and criteria to check; repeatable. Any additional ranges must contain the same number of rows and columns as criteria_range1. COUNTIF: Returns a conditional count across a range.
🌐
InfoInspired
infoinspired.com › home › google docs › spreadsheet › or logic in multiple columns with countifs in google sheets
OR Logic in Multiple Columns with COUNTIFS in Google Sheets
April 26, 2022 - We have seen a workaround solution already: COUNTIFS with Multiple Criteria in the Same Range in Google Sheets. However, the limitation is that it is not flexible enough to use a criteria range. That approach is best for hardcoding the criteria within the formula. Here, we will use REGEXREPLACE for applying OR logic in multiple columns in the COUNTIFS function.
🌐
Google Support
support.google.com › docs › thread › 198086660 › how-to-set-up-countifs-with-multiple-criteria
How to set up COUNTIFS with multiple criteria. - Google Docs Editors Community
January 19, 2023 - 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
🌐
Sheetgo
sheetgo.com › home › how to use countifs in google sheets
How to use COUNTIFS in Google Sheets - Sheetgo
December 17, 2025 - =COUNTIFS(C:C, “John”, D:D, “New*”, E:E, “<>”) You can even input Boolean values (TRUE and FALSE) as conditions. Keep in mind, avoid using quotations so Google Sheets recognizes these as Booleans and not text. This is particularly useful if you have checkboxes as they are just a visual representation of these values. If a checkbox is empty it’s FALSE and if’t filled it is TRUE. ... Usually you include columns as ranges, meaning Google Sheets will evaluate one row at a time.
🌐
Google Sheets
sheetsformarketers.com › home › blog › how to use countif with multiple ranges in google sheets
How to Use COUNTIF with Multiple Ranges in Google Sheets - Sheets for Marketers
April 21, 2023 - The COUNTIFS function in Google Sheets is a powerful tool that allows you to count the number of cells in one or more ranges that meet certain criteria. This can be incredibly useful for quickly analyzing your data. For example, given a database of orders, you can use the COUNTIFS function to know how many orders were made on a specific data that is under a certain amount. In this guide, we will show you how to use the COUNTIFS function with multiple ranges in Google Sheets.
🌐
Reddit
reddit.com › r/sheets › countif but with one criteria over multiple ranges?
r/sheets on Reddit: Countif but with one criteria over multiple ranges?
January 20, 2023 -

Is there a way to use a countif function, or a function like it, to check for a certain criteria over multiple ranges? All I can find is using it for one criteria over one range, or multiple criteria over multiple ranges.

🌐
Google Sites
sites.google.com › view › cpykquhtcj › google-spreadsheet-countif-multiple-columns
Google Spreadsheet Countif Multiple Columns
Another cells are using google spreadsheet countif multiple different values to count column names, for a lot of countblank in google sheets function works. Blog has text in google spreadsheet multiple columns you the cell on an array formula into the function as below is there a range or condition in the highlighting duplicates.