View Single Post
  #5   Report Post  
Aladin Akyurek
 
Posts: n/a
Default

In case of a range with #N/A's...

(a) If you have the latest version of Longre's morefunc.xll add-in:

=COUNTDIFF(IF(ISNA(P76:P79),0,P76:P79),FALSE,0)

(b) With built-in functions:

=SUM(IF(ISNUMBER(--(P76:P79<"")),--(IF(ISNA(P76:P79),FALSE,MATCH(P76:P79&"",P76:P79&" ",0))=ROW(INDEX(P76:P79,0,0))-ROW(P76)+1)))

These formulas must be confirmed with control+shift+enter, not just with
enter.

Mikus wrote:
I use following array formula to count unique values in range:

=SUM(IF(FREQUENCY(IF(LEN(P76:P79)0;MATCH(P76:P79; P76:P79;0);"");
IF(LEN(P76:P79)0;MATCH(P76:P79;P76:P79;0);""))0; 1))

IT works well if P76:P79 contains simple entered values, but returns N/A
error if cells have their own formulas. In my case in range P76:P79 i have
formula:

=IF($L76=1;HLOOKUP("Summa";INDIRECT(res.table);$M7 6);"")

which works perfectly well and returns following values:
P
76 "k"
77 "k"
78 "" <- (blank text)
79 "" <- (blank text)

I can't understand why does unique values formula fail to return value 1.
It does not fail if i replace formulas with their values (by copy, paste
values only) e.g
If range conain simple values unique value counter work's well, but if range
contains formulas it returns N/A eroor

How can i solve this problem ?


--

[1] The SumProduct function should implicitly coerce the truth values to
their Excel numeric equivalents.
[2] The lookup functions should have an optional argument for the return
value, defaulting to #N/A in its absence.