How to add number of non-blank cells in a range and leave blank if 0

OccamsShaver

New Member
Joined
Jul 14, 2017
Messages
9
Hi-
This is probably easy for the experienced folks here.
I am simply wanting to calculate the number of nonblank cells (numerical) between columns F2:BF2 and want to leave the new cell blank if all of the cells in that range are blank.

Any suggestions?

Thank you!

OS
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Try:
Code:
=IF(COUNTBLANK(F2:BF2)=53,"",COUNT(F2:BF2))
 
Upvote 0
Thank you, Joe4. I realize that I was not clear enough in my post.
What I am looking for is a formula that will produce a blank cell if all cells from F2:BF2 are blank. Otherwise, the formula should count the number of cells in the range that are >0.
 
Upvote 0
Just one minor modification then:
Code:
=IF(COUNTBLANK(F2:BF2)=53,"",COUNTIF(F2:BF2,">0"))
The one thing you haven't addressed is what you want to happen if there are any text entries or numerical values equal to or less than 0.
The formula above will just ignore those values.
 
Upvote 0
=text(countif(f2:bf2,">0"),"0;;")
Just be aware that will return a Text entry, and not a Numeric one.
That could be an issue if you are looking to use this count in any calculations or sorting.
 
Upvote 0
Is this correct?
=IF(COUNTBLANK(F3:BF3)=53,"",COUNTIF(F3:BF3,">0"))
That looks just like the formula I posted above, except you are referencing row 3 instead of row 2.
(All your previous posts mentioned row 2, not row 3).
 
Upvote 0
yes, a more practical solution is format cells with "0;;".
 
Upvote 0

Forum statistics

Threads
1,223,162
Messages
6,170,432
Members
452,326
Latest member
johnshaji

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