Skip to content

AVERAGEIF / SUMIF only works for a couple cases #44

@bryanbraun

Description

@bryanbraun

I noticed the following issues with AVERAGEIF and SUMIF not behaving like the implementation in Excel:

  1. AVERAGEIF / SUMIF assumes the cells are numeric for both the range and criteria. It will not successfully compare to text cells.
  2. The criteria parameter requires an operator... there is no implied equals.

Given this example spreadsheet...

A B
1 1 1
2 -1 2
3 yes 3
4 no 4

...here's the result of some formulas we could write:

Formula Works? Issue
=AVERAGEIF(A1:A2, '>0') none
=AVERAGEIF(A1:A2, '1') No implied equals
=AVERAGEIF(A3:A4, 'yes') Fails with text inputs

A few notes:

  • These issues occur whether or not the third optional parameter is used.
  • There are a few more minor differences, but I wouldn't consider them as high of a priority, since they are less commonly used. They include:
    • this implementation doesn't handle wildcards
    • this implementation accepts non-range values, whereas the implementations used in excel and google sheets do not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions