https://bugs.documentfoundation.org/show_bug.cgi?id=99291

--- Comment #4 from Eike Rathke <[email protected]> ---
(In reply to Jerzy Tyszkiewicz from comment #2)
> However, it does not work correctly, either. If the context is as follows:
> Column A: blank;1
> Column B: 1;2
> 
> then the formulas 
> =AVERAGEIF(B1:B2;A1:A2;A1)
> =AVERAGEIF(B1:B2;A1:A2;A2)
> compute 
> #DIV/0!;1
> while
> {=AVERAGEIF(B1:B2;A1:A2;A1:A2)}
> computes 
> #DIV/0!; #DIV/0!

There's nothing wrong with these.
It may not be immediately obvious, but
* assuming that
  =AVERAGEIF(B1:B2;A1:A2;A1) is placed in C1 and
  =AVERAGEIF(B1:B2;A1:A2;A2) is placed in C2
  then for the scalar Criteria (2nd parameter) the argument to match
  against B1:B2 is taken from the implicit intersection of the range
  A1:A2 and the formula cell position, hence the intersection for C1 is
  A1 and the intersection for C2 is A2.
  * The range to average (3rd parameter) *starts* at A1 for C1 and A2
    for C2, the actual dimension is taken from the range to match the
    criteria against.
* For the array/matrix case {=AVERAGEIF(B1:B2;A1:A2;A1:A2)} in the first
  iteration the criteria in A1 (empty) is matched against B1:B2 and for
  the matching positions (none) the average built over A1:A2 (no value
  => #DIV/0!) as result in row 1.
  * For the second iteration the criteria in A2 (1) is matched against
    B1:B2 with TRUE for B1 in the first row and FALSE for B2 in the
    second row. For the TRUE matching position row 1 in A1:A2 there is
    no value => #DIV/0! as result in row 2.

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to