Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to set a default value of zero when using COUNTA function in Google Sheets?

I'm using a pivot table in a Google Spreadsheet that counts the occurrences of different types of event-types on given dates. The events are listed on one sheet, with a column for "Date" and column for "Type." Based on this a Pivot Table is produced.

The trouble is that for dates when an event-type is non-existent, COUNTA returns empty. I'd rather it return 0.

The reason is for charting and statistical purposes when you create a chart from this data, it interpolates between values, ignoring empty cells. I'd prefer that it display zero on the chart on the days when these event types don't exist...

Is this possible?

like image 308
geb2011 Avatar asked Jul 17 '12 17:07

geb2011


People also ask

How does the Counta function work in Google Sheets?

COUNTA counts all values in a dataset, including those which appear more than once and text values (including zero-length strings and whitespace). To count unique values, use COUNTUNIQUE . To count only numeric values use COUNT .


1 Answers

UPD: sorry, I've misunderstood what you need. What if, on another worksheet, you write the following?

=arrayformula(IF('PivotSheetName'!A1:Z100="";0;'PivotSheetName'!A1:Z100))

(This formula makes a copy of your Pivot table on the new worksheet, replacing empty cells with 0; moreover, the control elements of the pivot table are copied to the new worksheet as well)

like image 119
user1525598 Avatar answered Dec 10 '22 19:12

user1525598