java.lang.Object
org.apache.poi.ss.formula.functions.Sumif
All Implemented Interfaces:
ArrayFunction, Function, Function2Arg, Function3Arg

public final class Sumif extends Object implements ArrayFunction
Implementation for the Excel function SUMIF

Syntax :
SUMIF ( range, criteria, sum_range )

Parameter descriptions
rangeThe range over which criteria is applied. Also used for addend values when the third parameter is not present
criteriaThe value or expression used to filter rows from range
sum_rangeLocates the top-left corner of the corresponding range of addends - values to be added (after being selected by the criteria)

  • Constructor Details

    • Sumif

      public Sumif()
  • Method Details

    • evaluate

      public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1)
      Description copied from interface: Function2Arg
      Specified by:
      evaluate in interface Function2Arg
    • evaluate

      public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1, ValueEval arg2)
      Description copied from interface: Function3Arg
      Specified by:
      evaluate in interface Function3Arg
    • evaluateArray

      public ValueEval evaluateArray(ValueEval[] args, int srcRowIndex, int srcColumnIndex)
      Evaluated in array context (the result feeds an array-mode function such as SUMPRODUCT, or the cell is part of an array formula): a multi-cell range as criteria means one sum per criterion.
      Specified by:
      evaluateArray in interface ArrayFunction
      Parameters:
      args - the evaluated function arguments. Empty values are represented with BlankEval or MissingArgEval, never null.
      srcRowIndex - row index of the cell containing the formula under evaluation
      srcColumnIndex - column index of the cell containing the formula under evaluation
      Returns:
      The evaluated result, possibly an ErrorEval, never null. Note - Excel uses the error code #NUM! instead of IEEE NaN, so when numeric functions evaluate to Double.NaN be sure to translate the result to ErrorEval.NUM_ERROR.
      Since:
      6.0.0
    • evaluate

      public final ValueEval evaluate(ValueEval[] args, int srcRowIndex, int srcColumnIndex)
      Specified by:
      evaluate in interface Function
      Parameters:
      args - the evaluated function arguments. Empty values are represented with BlankEval or MissingArgEval, never null.
      srcRowIndex - row index of the cell containing the formula under evaluation
      srcColumnIndex - column index of the cell containing the formula under evaluation
      Returns:
      The evaluated result, possibly an ErrorEval, never null. Note - Excel uses the error code #NUM! instead of IEEE NaN, so when numeric functions evaluate to Double.NaN be sure to translate the result to ErrorEval.NUM_ERROR.