CountA issues

lljones

New Member
Joined
Aug 24, 2019
Messages
10
Using COUNTA to exclude blanks – having issues

I have a spreadsheet that has 101 rows of data (First row contains column headings)

Column B is a text field. There are four blank cells, so the correct count is 96.

=COUNTA(B2:B101) returns 96
=COUNTA(B:B) returns 98
=COUNTA(RGIndex!Authors) returns 98 <--named range

Column C is a numeric field. Same four blank cells so correct count is 96.

=COUNTA(C2:C101) returns 96
=COUNTA(C:C) returns 97
=COUNTA(RGIndex!BookCt) returns 97 <--named range

How do I get the correct results without stating a specific range (B2:B101, etc.)?

Thanks in advance.
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Do you have some entries in column B, below B101, that shouldn't be there ?

If yes, consider deleting them or moving them.

If you need them to stay where they are, and you know there will only ever be 2 of them, consider something like
=counta(b:b)-2
 
Upvote 0
No, nothing below row 101.

Sorry, I had a typo in my first post. Should look like this:

=COUNTA(B2:B101) returns 96
=COUNTA(B:B) returns 97
=COUNTA(RGIndex!Authors) returns 97 <--named range

Column C is a numeric field. Same four blank cells so correct count is 96.

=COUNTA(C2:C101) returns 96
=COUNTA(C:C) returns 97
=COUNTA(RGIndex!BookCt) returns 97 <--named range

I'm assuming the issue has to do with Row 1 - column headings - ????
 
Upvote 0
Ah, yes, I should have thought of that, probably column headings are causing this, assuming you actually have a column heading in Cols B and C.

Again, if you need them, and you know you will only ever have 1 row of column headings, then consider using
=counta(b:b)-1
 
Upvote 0
Rename Your range without Heading, It will sort out your problem.:)

Name Range With Heading Result =COUNTA(km)
[TABLE="width: 64"]
<colgroup><col width="64" style="width:48pt"> </colgroup><tbody>[TR]
[TD="width: 64"]Total[/TD]
[/TR]
[TR]
[TD="class: xl64, align: right"]2[/TD]
[/TR]
[TR]
[TD="class: xl63, align: right"]2[/TD]
[/TR]
[TR]
[TD="class: xl64, align: right"]2[/TD]
[/TR]
[TR]
[TD="class: xl63, align: right"]2[/TD]
[/TR]
[TR]
[TD="class: xl64, align: right"]2[/TD]
[/TR]
[TR]
[TD="class: xl63, align: right"]2[/TD]
[/TR]
[TR]
[TD="class: xl64, align: right"]2[/TD]
[/TR]
[TR]
[TD="class: xl63, align: right"]2[/TD]
[/TR]
[TR]
[TD="class: xl64, align: right"]2[/TD]
[/TR]
[TR]
[TD="class: xl63, align: right"]2[/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]11[/TD]
[/TR]
</tbody>[/TABLE]

[TABLE="width: 64"]
<colgroup><col width="64" style="width:48pt"> </colgroup><tbody>[TR]
[TD="width: 64"]Total Name Range Without Heading Result [/TD]
[/TR]
[TR]
[TD="class: xl66, align: right"]2[/TD]
[/TR]
[TR]
[TD="class: xl65, align: right"]2[/TD]
[/TR]
[TR]
[TD="class: xl66, align: right"]2[/TD]
[/TR]
[TR]
[TD="class: xl65, align: right"]2[/TD]
[/TR]
[TR]
[TD="class: xl66, align: right"]2[/TD]
[/TR]
[TR]
[TD="class: xl65, align: right"]2[/TD]
[/TR]
[TR]
[TD="class: xl66, align: right"]2[/TD]
[/TR]
[TR]
[TD="class: xl65, align: right"]2[/TD]
[/TR]
[TR]
[TD="class: xl66, align: right"]2[/TD]
[/TR]
[TR]
[TD="class: xl65, align: right"]2[/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]10[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0

Forum statistics

Threads
1,223,715
Messages
6,174,064
Members
452,542
Latest member
Bricklin

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?

Disable AdBlock

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
Back
Top