countblank but cell is not blank, has space

lezawang

Well-known Member
Joined
Mar 27, 2016
Messages
1,805
Office Version
  1. 2016
Platform
  1. Windows
Hi
I know =countblank() would count empty cells, but how to count empty cells (which look empty but has space char entered)?
Thank you so much.
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Thanks, that works but it will also count cells which has text like this A1= "Good morning" , A2= "how are you"
I want the count to count cell which has " " once space or " " multiple spaces but no text (only spacebar entered)
Thank you.


=countif(h53:j61,"* *")
 
Upvote 0
=sumproduct(--(substitute(a1:a10," ","")=""))
 
Last edited:
Upvote 0
Sweet solution ZVI!:) that will count blank cells and cells with spaces. I guess if you just wanted cells with spaces would just subtract a Countblank(A1:A10) from your formula.
 
Last edited:
Upvote 0
Curiously COUNTBLANK counts not only the empty cells but also cells with empty string values (such as result of formula ="" or copy as value of that formula).
But ISBLANK for the latter returns FALSE – see A3 and B3.


Excel 2010 32 bit
ABC
1DataISBLANKCOUNTBLANK
2TRUE1
3 FALSE1
Sheet2
Cell Formulas
RangeFormula
B2=ISBLANK(A2)
B3=ISBLANK(A3)
C2=COUNTBLANK(A2)
C3=COUNTBLANK(A3)
A3=""
 
Last edited:
Upvote 0
Yea i just saw that a few minutes ago while looking at another question the OP posted. A single apostrophe in a cell (') will yield a similar result as =""
 
Upvote 0
Hi
I know =countblank() would count empty cells, but how to count empty cells (which look empty but has space char entered)?
Thank you so much.

Count of a single space housing cells:

=COUNTIFS(A1:A10,"?",A1:A10," ")

Count of one or more space housing cells:

Either...
=SUMPRODUCT((TRIM(A1:A10)="")+0)-COUNTBLANK(A1:A10)

Or...
=SUMPRODUCT(--(SUBSTITUTE(A1:A10," ","")=""))-COUNTBLANK(A1:A10)
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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