Class BasicFormulas


  • public final class BasicFormulas
    extends Object
    Class for handling of basic Excel formulas
    Author:
    Raphael Stoeckli
    • Constructor Detail

      • BasicFormulas

        public BasicFormulas()
    • Method Detail

      • Average

        public static Cell Average​(Range range)
        Returns a cell with a average formula
        Parameters:
        range - Cell range to apply the average operation to
        Returns:
        Prepared Cell Object, ready to be added to a worksheet
      • Average

        public static Cell Average​(Worksheet target,
                                   Range range)
        Returns a cell with a average formula
        Parameters:
        target - Target worksheet of the average operation. Can be null if on the same worksheet
        range - Cell range to apply the average operation to
        Returns:
        Prepared Cell Object, ready to be added to a worksheet
      • Ceil

        public static Cell Ceil​(Address address,
                                int decimals)
        Returns a cell with a ceil formula
        Parameters:
        address - Address to apply the ceil operation to
        decimals - Number of decimals (digits)
        Returns:
        Prepared Cell Object, ready to be added to a worksheet
      • Ceil

        public static Cell Ceil​(Worksheet target,
                                Address address,
                                int decimals)
        Returns a cell with a ceil formula
        Parameters:
        target - Target worksheet of the ceil operation. Can be null if on the same worksheet
        address - Address to apply the ceil operation to
        decimals - Number of decimals (digits)
        Returns:
        Prepared Cell Object, ready to be added to a worksheet
      • Floor

        public static Cell Floor​(Address address,
                                 int decimals)
        Returns a cell with a floor formula
        Parameters:
        address - Address to apply the floor operation to
        decimals - Number of decimals (digits)
        Returns:
        Prepared Cell Object, ready to be added to a worksheet
      • Floor

        public static Cell Floor​(Worksheet target,
                                 Address address,
                                 int decimals)
        Returns a cell with a floor formula
        Parameters:
        target - Target worksheet of the floor operation. Can be null if on the same worksheet
        address - Address to apply the floor operation to
        decimals - Number of decimals (digits)
        Returns:
        Prepared Cell Object, ready to be added to a worksheet
      • Max

        public static Cell Max​(Range range)
        Returns a cell with a max formula
        Parameters:
        range - Cell range to apply the max operation to
        Returns:
        Prepared Cell Object, ready to be added to a worksheet
      • Max

        public static Cell Max​(Worksheet target,
                               Range range)
        Returns a cell with a max formula
        Parameters:
        target - Target worksheet of the max operation. Can be null if on the same worksheet
        range - Cell range to apply the max operation to
        Returns:
        Prepared Cell Object, ready to be added to a worksheet
      • Median

        public static Cell Median​(Range range)
        Returns a cell with a median formula
        Parameters:
        range - Cell range to apply the median operation to
        Returns:
        Prepared Cell Object, ready to be added to a worksheet
      • Median

        public static Cell Median​(Worksheet target,
                                  Range range)
        Returns a cell with a median formula
        Parameters:
        target - Target worksheet of the median operation. Can be null if on the same worksheet
        range - Cell range to apply the median operation to
        Returns:
        Prepared Cell Object, ready to be added to a worksheet
      • Min

        public static Cell Min​(Range range)
        Returns a cell with a min formula
        Parameters:
        range - Cell range to apply the min operation to
        Returns:
        Prepared Cell Object, ready to be added to a worksheet
      • Min

        public static Cell Min​(Worksheet target,
                               Range range)
        Returns a cell with a min formula
        Parameters:
        target - Target worksheet of the min operation. Can be null if on the same worksheet
        range - Cell range to apply the median operation to
        Returns:
        Prepared Cell Object, ready to be added to a worksheet
      • Round

        public static Cell Round​(Address address,
                                 int decimals)
        Returns a cell with a round formula
        Parameters:
        address - Address to apply the round operation to
        decimals - Number of decimals (digits)
        Returns:
        Prepared Cell Object, ready to be added to a worksheet
      • Round

        public static Cell Round​(Worksheet target,
                                 Address address,
                                 int decimals)
        Returns a cell with a round formula
        Parameters:
        target - Target worksheet of the round operation. Can be null if on the same worksheet
        address - Address to apply the round operation to
        decimals - Number of decimals (digits)
        Returns:
        Prepared Cell Object, ready to be added to a worksheet
      • Sum

        public static Cell Sum​(Range range)
        Returns a cell with a sum formula
        Parameters:
        range - Cell range to get a sum of
        Returns:
        Prepared Cell Object, ready to be added to a worksheet
      • Sum

        public static Cell Sum​(Worksheet target,
                               Range range)
        Returns a cell with a sum formula
        Parameters:
        target - Target worksheet of the sum operation. Can be null if on the same worksheet
        range - Cell range to get a sum of
        Returns:
        Prepared Cell Object, ready to be added to a worksheet
      • VLookup

        public static Cell VLookup​(Object number,
                                   Range range,
                                   int columnIndex,
                                   boolean exactMatch)
        Function to generate a Vlookup as Excel function
        Parameters:
        number - Numeric value for the lookup. Valid types are int, long, float and double
        range - Matrix of the lookup
        columnIndex - Column index of the target column (1 based)
        exactMatch - If true, an exact match is applied to the lookup
        Returns:
        Prepared Cell Object, ready to be added to a worksheet
      • VLookup

        public static Cell VLookup​(Object number,
                                   Worksheet rangeTarget,
                                   Range range,
                                   int columnIndex,
                                   boolean exactMatch)
        Function to generate a Vlookup as Excel function
        Parameters:
        number - Numeric value for the lookup. Valid types are int, long, float and double
        rangeTarget - Target worksheet of the matrix. Can be null if on the same worksheet
        range - Matrix of the lookup
        columnIndex - Column index of the target column (1 based)
        exactMatch - If true, an exact match is applied to the lookup
        Returns:
        Prepared Cell Object, ready to be added to a worksheet
      • VLookup

        public static Cell VLookup​(Address address,
                                   Range range,
                                   int columnIndex,
                                   boolean exactMatch)
        Function to generate a Vlookup as Excel function
        Parameters:
        address - Query address of a cell as string as source of the lookup
        range - Matrix of the lookup
        columnIndex - Column index of the target column (1 based)
        exactMatch - If true, an exact match is applied to the lookup
        Returns:
        Prepared Cell Object, ready to be added to a worksheet
      • VLookup

        public static Cell VLookup​(Worksheet queryTarget,
                                   Address address,
                                   Worksheet rangeTarget,
                                   Range range,
                                   int columnIndex,
                                   boolean exactMatch)
        Function to generate a Vlookup as Excel function
        Parameters:
        queryTarget - Target worksheet of the query argument. Can be null if on the same worksheet
        address - Query address of a cell as string as source of the lookup
        rangeTarget - Target worksheet of the matrix. Can be null if on the same worksheet
        range - Matrix of the lookup
        columnIndex - Column index of the target column (1 based)
        exactMatch - If true, an exact match is applied to the lookup
        Returns:
        Prepared Cell Object, ready to be added to a worksheet