View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Harlan Grove
 
Posts: n/a
Default Count Non-Blank Rows

Biff wrote...
....
This is what I came up with (in reponse to another post in .Misc)

=SUM(A1,A11:A12,IF(A13="x",A14,0))/(3+(A13="x"))

....

If the goal is averaging A1, A11, A12 and A14 only when A13 = "x", then
just modify your original AVERAGE formula a little - change "" into
{""}. That is,

=AVERAGE(A1,A11:A12,IF(A13="x",A14,""))

returns a #VALUE! error when A13 < "x", but

=AVERAGE(A1,A11:A12,IF(A13="x",A14,{""}))

returns the same result as =AVERAGE(A1,A11:A12). This is due to
automatic number/text conversion semantics. AVERAGE("1","2") returns
1.5, but AVERAGE({"1","2"}) returns #DIV/0! . Excel *ALWAYS* tries to
convert text scalars (and booleans) to numbers in numeric contexts and
numeric scalars (and booleans) to text in text contexts.