# Is there a way to count values that are of a certain criteria when they are in an array.

#### scowie

##### New Member
Hi,

I have this function, for simplicity's sake it is provided below:

=FREQUENCY(IF(A1:J1<>"", COLUMN(A1:J1)),IF(A1:J1="",COLUMN(A1:J1)))

Cells A1:Z1 are populated with a series of number with blank cells in between them, and the function above calculates how many cells are in a row until a blank cell appears. For example,
 A B C D E F G H I J 10 10 10 10 10 10

<tbody>
</tbody>

So when the function above is Ctrl+Shift+Entered, the output is 2 (three successive cells populated to start), and when I F9 the formula the output is ={2;0;3;0;1}. Is there a way I can implement COUNT in order to count the number of non-zero values in {2;0;3;0;1}, so the output would be 3?

Thank you!!

### Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

#### XOR LX

##### Well-known Member
Hi.

You could use an array formula**.

Either:

=COUNT(1/FREQUENCY(IF(A1:J1<>"",COLUMN(A1:J1)),IF(A1:J1="",COLUMN(A1:J1))))

or:

=SUM(IF(FREQUENCY(IF(A1:J1<>"",COLUMN(A1:J1)),IF(A1:J1="",COLUMN(A1:J1))),1))

Regards

**Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).

#### scowie

##### New Member
Yes that works!! Thanks you very very much!!

You're welcome!

Cheers

Replies
7
Views
125
Replies
3
Views
234
Replies
11
Views
379
Replies
0
Views
148
Replies
5
Views
595

1,186,692
Messages
5,959,208
Members
438,404
Latest member
RailEngineer76

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back