# Counting formulas referring to a range containing formulas

### Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

##### MrExcel MVP
Care to post the COUNTIF formula giving you the wrong results?

##### Well-known Member
Countblank will count "" as blank, CountA will not. That's all I can think of since:

Excel 2010
ABCDEF
1
2thethe1book1
3my
4mine
5your
6aa1library5
7aa2pen6
8anan1apple7
9Germany
10England
11thethe2librarian10
12thethe3forest11
13anan2uncle1233
1415
Sheet16
Cell Formulas
RangeFormula
F13=COUNTA(A2:D13)
F14=COUNTBLANK(A2:D13)

Last edited:

#### sevas1994

##### Active Member

 Formulas in B column Formulas in D column a an the the the1 book 1 =A2&IF(A2="", "", COUNTIF(\$A\$2:A2, A2)) =IF(B2="", "", COUNTA(\$B\$2:B2)) 1 library apple book Formulas in L column my =A3&IF(A3="", "", COUNTIF(\$A\$2:A3, A3)) 2 pen uncle librarian =counta(B2:B13) 12 mine =A4&IF(A4="", "", COUNTIF(\$A\$2:A4, A4)) 3 #N/A #N/A forest =count(D2:D13) 7 your =A5&IF(A5="", "", COUNTIF(\$A\$2:A5, A5)) 4 #N/A #N/A #N/A =COUNTBLANK(D2:D13) 5 a a1 library 5 5 #N/A #N/A #N/A =countif(B2:B13, "*") 12 a a2 pen 6 6 #N/A #N/A #N/A =countif(D2:D13, "*") 5 an an1 apple 7 7 #N/A #N/A #N/A =rows(A2:D13)*columns(A2:D13) 48 Germany 8 #N/A #N/A #N/A =counta(A2:D13)+countblank(A2:D13) 58 England 9 #N/A #N/A #N/A the the2 librarian 10 10 #N/A #N/A #N/A the the3 forest 11 11 #N/A #N/A #N/A an an2 uncle 12

<colgroup><col style="width: 60px"><col width="60"><col width="60"><col width="60"><col width="268"><col width="198"><col width="60"><col width="60"><col width="60"><col width="60"><col width="228"><col width="60"></colgroup><tbody>
</tbody>

#### sevas1994

##### Active Member

 Formulas in B column Formulas in C column a an the the the1 book 1 =A2&IF(A2=""; ""; COUNTIF(\$A\$2:A2; A2)) =IF(B2=""; ""; COUNTA(\$B\$2:B2)) 1 library apple book total cells 48 =COLUMNS(A2:D13)*ROWS(A2:D13) my =A3&IF(A3=""; ""; COUNTIF(\$A\$2:A3; A3)) =IF(B3=""; ""; COUNTA(\$B\$2:B3)) 2 pen uncle librarian total cells 58 =COUNTA(A2:D13)+COUNTBLANK(A2:D13) mine =A4&IF(A4=""; ""; COUNTIF(\$A\$2:A4; A4)) =IF(B4=""; ""; COUNTA(\$B\$2:B4)) 3 #N/A #N/A forest Non-text values 12 =COUNTIF(A2:D13; "<>*") your =A5&IF(A5=""; ""; COUNTIF(\$A\$2:A5; A5)) 4 #N/A #N/A #N/A Non-blank values in formula 12 =COUNTA(B2:B13) a a1 library 5 =A6&IF(A6=""; ""; COUNTIF(\$A\$2:A6; A6)) 5 #N/A #N/A #N/A Blank cells in formula 5 =COUNTBLANK(B2:B13) a a2 pen 6 =A7&IF(A7=""; ""; COUNTIF(\$A\$2:A7; A7)) 6 #N/A #N/A #N/A Numeric values 7 =COUNT(A2:D13) an an1 apple 7 =A8&IF(A8=""; ""; COUNTIF(\$A\$2:A8; A8)) 7 #N/A #N/A #N/A Non-text values 12 {=SUM(IF(ISNONTEXT(A2:D13);1))} Germany 8 #N/A #N/A #N/A Text values 36 {=SUM(IF(ISTEXT(A2:D13);1))} England 9 #N/A #N/A #N/A Text values 36 =COUNTIF(A2:D13; "*") the the2 librarian 10 10 #N/A #N/A #N/A N/A value 26 =COUNTIF(H1:J12; "#N/A") the the3 forest 11 11 #N/A #N/A #N/A an an2 uncle 12

<colgroup><col span="4"><col><col><col span="4"><col><col span="4"></colgroup><tbody>
</tbody>

##### MrExcel MVP
@sevas1994

Would you mind posting just the data and the expected results?

Attachments lists a few methods for posting sample exhibits which do not require retyping and the add-in https://app.box.com/s/soezox25h3w0q5s4rcyl
is also a method for posting an exhibit.<strike></strike>

##### Well-known Member

If you're trying to exclude "" and true blanks from your count:

Excel 2010
ABCDEF
2thethe1book1
3  my
4  mine
5  your
6aa1library5
7aa2pen6
8anan1apple7
9  Germany
10  England
11thethe2librarian10
12thethe3forest11
13anan2uncle1233
1415
Sheet16
Cell Formulas
RangeFormula
A3=""
A4=""
A5=""
A9=""
A10=""
B3=""
B4=""
B5=""
B9=""
B10=""
F13=SUMPRODUCT(--(LEN(A2:D13)<>0))
F14=SUMPRODUCT(--(LEN(A2:D13)=0))

is another way

##### MrExcel MVP
If you're trying to exclude "" and true blanks from your count:

[...]

F13 =SUMPRODUCT(--(LEN(A2:D13)<>0)) =SUMPRODUCT(--(LEN(A2:D13)=0))

<tbody>
</tbody>

is another way

=COUNTIFS(A2:D13,"?*")

=COUNTIFS(A2:D13,"")

would be tad faster in this type of text situations.

##### Well-known Member
=COUNTIFS(A2:D13,"?*")

I get 26 though (because of the numbers in column D perhaps)

Last edited:

##### MrExcel MVP
I get 26 though (because of the numbers in column D perhaps)

That would require expanding:

=COUNTIFS(A2:D13,"?*")+COUNT(A2:D13)

which might be still a good score qua performance. Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

### Forum statistics

1,164,068
Messages
5,835,204
Members
430,345
Latest member
Yousef081 ### 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