Countifs VBA

The COUNTIFS function is a popular function if you want to count values for multiple conditions. It can also be used with VBA.

First, let’s take a look at how it works inside a worksheet.

The application counts numbers that are larger than 5, and smaller than 8.

In our example, there are three such numbers in cells: A1, C1, and G1.


You can create a procedure in VBA that will look like this:

If you run this code, it’s going to return the following message.