Can COUNTA function in Google Sheets be set to show zero instead of blank for non-existent values?

Hey everyone! I’m working on a Google Sheets project and I’m stuck. I’ve got a pivot table that’s counting different event types by date. My data is on one sheet with columns for ‘Date’ and ‘Type’.

The problem is when there’s no event on a certain date, COUNTA leaves the cell empty. But I really need it to show 0 instead. This is messing up my charts because they’re skipping over the empty cells and connecting the dots where there’s actual data.

I want my charts to show zero on days when nothing happened. It would make my stats look way more accurate. Is there any way to make COUNTA do this? Or maybe there’s another function I should be using?

Any help would be awesome. Thanks!

While COUNTA won’t directly show zeros for non-existent values, there’s a neat workaround using a combination of functions. Try this formula:

=IF(COUNTA(range)=0, 0, COUNTA(range))

This checks if COUNTA returns zero (meaning no values found), and if so, it displays 0. Otherwise, it shows the actual count. You’ll need to apply this to each cell in your pivot table where you want zeros to appear.

For a more automated approach, you could use the QUERY function to create a complete dataset with all dates, then join it with your existing data. This ensures all dates are present, even when no events occurred.

Remember to adjust your chart settings to treat empty cells as zero for consistent visualization.

I’ve dealt with this exact issue in my work. COUNTA won’t give you zeros, but there’s a workaround. Try using an array formula with IFERROR. Something like:

=ArrayFormula(IFERROR(COUNTIF(range, criteria), 0))

This will count your values and replace any blank results with zeros. You might need to adjust your pivot table to accommodate this change. It’s a bit more complex, but it solved the problem for me and made my charts much more accurate.

Remember to press Ctrl+Shift+Enter when entering the formula, as it’s an array formula. Hope this helps with your project!

hey there! i’ve run into this before. COUNTA won’t do what u want, but you could try COUNTIF instead. something like =COUNTIF(range, “*”). it’ll give you zeros for empty cells. might need to tweak ur pivot table setup a bit tho. good luck with ur project!