I have a list of data as shown below. I am trying to count how many occurences there are of each unique value.
But some of these values are error values, such as #N/A
. Is there a formula that can count both regular values and error values?
This one (entered as an array formula) can count the a
's and other regular values:
=SUM(--IFERROR($A$2:$A$14=C2,FALSE))
But if I copy it down, obviously it doesn't work for the error value totals, because it ignores the errors using IFERROR
.
I know I can count the #N/A
's using this:
=SUM(--ISNA($A$2:$A$14))
but it's a different formula entirely; I can't just drag-copy it down the column.
I'm looking for a formula that can accommodate both without "changing the source code".
COUNTIF
does count them properly, but I don't think I can use it, as this is only meant to be a piece of a larger array formula.
If you not able using COUNTIF
, try following formula in D2
{=SUM(IFERROR($A$2:$A$14=C2,FALSE)+IFERROR(ERROR.TYPE($A$2:$A$14)=ERROR.TYPE(C2),FALSE))}