# How Use COUNTIF to Count Non Empty Cells in Excel

#### Dossfm0q

##### Banned User
How to Use COUNTIF to Count Non Empty Cells in Excel

Code:
``````Sub CountNonBlank()

Cells.Clear
Range("A1:A7") = Application.Transpose(Array("A", "B", "C", "D", "E", "", ""))

Range("A10").Formula = "[COLOR=#ff0000][B]=COUNTIF(A1:A7,""<>"""""")[/B][/COLOR]" ' [COLOR=#ff0000]Rong result[/COLOR]

Range("A12").Formula = "=[COLOR=#006400][B]ROWS(A1:A7) * COLUMNS(A1:A7)-COUNTBLANK(A1:A7)[/B][/COLOR]" ' [B][COLOR=#008000]Wright result[/COLOR][/B]
'''''''''''''''''''''''''''''''''''''''''
With Range("B10")
.Value = "O"
.Font.Name = "Wingdings 2"
End With
With Range("B12")
.Value = "P"
.Font.Name = "Wingdings 2"
End With
''''''''''''''''''''''''''''''''''''''
End Sub``````

### Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Have you tried =COUNTA(A1:A7)

Yes Sir I did

Code:
``````Public Sub CountNonEmptyCell()

Cells.Clear
[A1] = "A,BB,CCC,DDDD,EEEEE,FFFFFF"

Range("A3:A12").FormulaArray = "=IFERROR(MID(A\$1,FIND(""|"",SUBSTITUTE("",""&A\$1&"","","","",""|"",(ROW()-ROW(B\$3)+1))),FIND("","",A\$1&"","",FIND(""|"",SUBSTITUTE("",""&A\$1&"","","","",""|"",(ROW()-ROW(B\$3)+1))))-FIND(""|"",SUBSTITUTE("",""&A\$1&"","","","",""|"",(ROW()-ROW(B\$3)+1)))),"""")"

[COLOR=#ff0000][B] [A13] = "=COUNTA(A3:A12)"[/B][/COLOR]
Range("A14").Formula = "=ROWS(A3:A12) * COLUMNS(A3:A12)-COUNTBLANK(A3:A12)"
End Sub``````

Last edited:
=countifs(a:a,”?*”)

=countifs(a:a,”<>”)

still has same err

Thanks for respond

You say they all have the same error, but don't describe the error.
What do those approches do that isn't right?

still has same err

Thanks for respond

What is giving the error? And what is the error?

I am apologize! I get busy
I don't main There is an Error, I main the empty cells of array formula are uncountable with this function.

I am sorry about misunderstand from my side.

I am apologize! I get busy
I don't main There is an Error, I main the empty cells of array formula are uncountable with this function.

I am sorry about misunderstand from my side.

What do you want to count?

If empty/blank cells:

=COUNTIFS(A2:A100,"=")

If non-blanks cells:

=COUNTIFS(A2:A100,"<>")

Replies
4
Views
256
Replies
0
Views
528
Replies
0
Views
383
Replies
5
Views
415
Replies
1
Views
823

1,196,306
Messages
6,014,565
Members
441,828
Latest member
cofracr

### 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.
Allow Ads at MrExcel

### Which adblocker are you using?

Follow these easy steps to disable AdBlock

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

### Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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