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

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
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)
Total
2
2
2
2
2
2
2
2
2
2
11

<colgroup><col width="64" style="width:48pt"> </colgroup><tbody>
</tbody>

Total Name Range Without Heading Result
2
2
2
2
2
2
2
2
2
2
10

<colgroup><col width="64" style="width:48pt"> </colgroup><tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,215,043
Messages
6,122,812
Members
449,095
Latest member
m_smith_solihull

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