Count cells that contain errors in Excel and Google Sheets

=SUMPRODUCT(--ISERROR(A2:A6))

=SUM(--ISERROR(A2:A6))

*If not Office 365 version: use "Ctrl+Shift+Enter" for both formula

A2:A6 = Ranges

Check below for a detailed explanation with pictures and how to use formulas in Excel and Google Sheets.