## Use COUNTIF on a non-contiguous range in Excel

Author: Siluvia Last Modified: 2021-09-24

This step-by-step guide demonstrates how to use the countif function on a non-contiguous range in Excel. Supposing there are three non-contiguous ranges B5:B12, D5:D13 and F7:F11 in your worksheet, to count number of cells that are greater than 80 in these specified ranges, you can use the COUNTIF function together with the INDIRECT and SUM functions to get it done.

#### How to use COUNTIF on a non-contiguous range in Excel?

Before using the COUNTIF function for non-contiguous range, let’s know what a non-contiguous range is. A non-contiguous range consists of many separate ranges in a worksheet, such as the ranges B5:B12, D5:D13 and F7:F11 as the below screenshot shown.

To count number of cells that are greater than 80 in this non-contiguous range, please apply the below formula.

Generic Formulas

=SUM(COUNTIF(INDIRECT({"rng1","rng2","rng3"}),criteria))

Arguments

Rng1: The first range of the non-contiguous range.
Rng2: The second range of the non-contiguous range.
Rng3: The third range of the non-contiguous range.
Criteria: The criteria you want to count cells based on.

How to use these formulas?

1. Select a blank cell.

2. Enter the below formula into it and press the Enter key to get the result.

=SUM(COUNTIF(INDIRECT({"B5:B12","D5:D14","F7:F11"}),">80"))

Notes:: In the formula, you can change the ranges and criteria based on your needs.

#### Related functions

Excel SUM function
The Excel SUM function adds values.

Excel COUNTIF function
The Excel COUNTIF function is used to count the number of cells that meet a criterion.

Excel INDIRECT function
The Excel INDIRECT function converts a text string to a valid reference.

#### Related formulas

Count Number Of Visible Rows In A Filtered List
This tutorial explains how to count number of visible rows in a filtered list in Excel with the SUBTOTAL function.

Count unique values in a range
This tutorial explains how to count only the unique values among duplicates in a list in Excel with specified formulas.

Count unique values with criteria
This step-by-step guide helps to count only unique values based on a specified criteria in another column

Count visible rows with criteria/a>
This tutorial provides detailed steps to help you count visible rows with criteria.

### The Best Office Productivity Tools

#### Kutools for Excel - Helps You To Stand Out From Crowd

 🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions… Popular Features: Find, Highlight or Identify Duplicates  |  Delete Blank Rows  |  Combine Columns or Cells without Losing Data  |  Round without Formula ... Super VLookup: Multiple Criteria  |  Multiple Value  |  Across Multi-Sheets  |  Fuzzy Lookup... Adv. Drop-down List: Easy Drop Down List  |  Dependent Drop Down List  |  Multi-select Drop Down List... Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Columns to Select Same & Different Cells ... Featured Features: Grid Focus  |  Design View  |  Big Formula Bar  |  Workbook & Sheet Manager | Resource Library (Auto Text)  |  Date Picker  |  Combine Worksheets  |  Encrypt/Decrypt Cells  |  Send Emails by List  |  Super Filter  |  Special Filter (filter bold/italic/strikethrough...) ... Top 15 Toolsets:  12 Text Tools (Add Text, Remove Characters ...)  |  50+ Chart Types (Gantt Chart ...)  |  40+ Practical Formulas (Calculate age based on birthday ...)  |  19 Insertion Tools (Insert QR Code, Insert Picture from Path ...)  |  12 Conversion Tools (Numbers to Words, Currency Conversion ...)  |  7 Merge & Split Tools (Advanced Combine Rows, Split Excel Cells ...)  |  ... and more

Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need is Just A Click Away...

#### Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)

• One second to switch between dozens of open documents!
• Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
• Increases your productivity by 50% when viewing and editing multiple documents.
• Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Edge and Firefox.
Sort comments by
Comments (4)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
I have Excel 2019 and the formula does not work, when I place the quotes (") it shows an error, how to make it work?
This comment was minimized by the moderator on the site
Hi Miriam,

Regarding the formula =SUM(COUNTIF(INDIRECT({"B5:B12","D5:D14","F7:F11"}),">80")) not working, the reason could be:

INDIRECT and Arrays:
The INDIRECT function is used to convert text strings into cell references. In some Excel versions (including Excel 2019), the INDIRECT function does not support arrays as input. This means that INDIRECT({"B5:B12","D5:D14","F7:F11"}) might not correctly parse as references to multiple regions.
Typically, in newer versions of Excel, such as Excel 365, there is better support for arrays and dynamic array capabilities, which may handle this type of usage better.

To achieve similar functionality in Excel 2019, you can use separate COUNTIF functions and combine their results, instead of trying to merge them into an array with INDIRECT. For example:
=SUM(COUNTIF(B5:B12, ">80"), COUNTIF(D5:D14, ">80"), COUNTIF(F7:F11, ">80"))
This comment was minimized by the moderator on the site
I have Excel 2019 and the formula does not work, when I place the quotes (") it shows an error, how to make it work?
This comment was minimized by the moderator on the site

=SUM(COUNTIF(Y36,AA36, AC36,{"P","M"})*3.75)
There are no comments posted here yet
Leave your comments
Posting as Guest
Rate this post:
0   Characters
Suggested Locations