Counting Non-Hidden Cells in a Row

dbrown14

New Member
Joined
May 24, 2011
Messages
13
I need to be able to count the number of cells in a row that contain numbers, but exclude the hidden columns. Here is a crude example:

Row1: 5 7 4 6 8 10 Count=6
Now I hide two rows
Row1: 5 7 8 10 Count=4


Any help is appreciated but no macros please. I need this to be as user friendly as possible. I also know that SUBTOTAL works great with this when the data is in a column but it doesn't want to work when I use it on a row like the example.
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Hallo

Example of a formula with the Italian text to be converted

Code:
=SE(CELLA("larghezza";A12)=0;0;A12)+SE(CELLA("larghezza";B12)=0;0;B12)
This wants to be an example to be completed for the next column!

Excuse the incomplete formula!
 
Upvote 0
I understand your algorithm and tried it in the form of this equation:

Code:
{=SUM(IF(CELL("width",A1:J1)>0,1))}
but the result is always "2". I'm not expert at excel so if my formula is off please help me and any other suggestions are welcome.
 
Upvote 0
Hallo
I forgot to update you recalculate the spreadsheet formulas with F9
 
Upvote 0
The number stays the same when I do that.

And I don't understand why AGGREGATE and SUBTOTAL have the option to ignore hidden rows but not hidden columns.
 
Upvote 0
Hallo

I confirm that I sent you the formula that works regularly
Retry
 
Upvote 0
I put your exact code into my cell where the count is supposed to be and I got the sum of all the visible cells. Not the count of how many cells are visible
 
Upvote 0
I put your exact code into my cell where the count is supposed to be and I got the sum of all the visible cells. Not the count of how many cells are visible
That formula won't work.

You would need to put a formula like this in a row of helper cells.

Let's assume row 1, A1:J1.

=CELL("width",A1)

Then, in some cell, say cell L1, enter this formula:

=COUNTIF(A1:J1,">0")

However, hiding/unhiding a column does not trigger a calculation so you would have to do a manual calculation to get the formula to update or you'd have to wait until some other event triggered a calculation.

This is probably not what you had in mind so you may want to reconsider why you're doing this to begin with.
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,287
Members
452,902
Latest member
Knuddeluff

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