The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Spreadsheet::Engine::Functions - Spreadsheet functions (SUM, MAX, etc)

SYNOPSIS

  my $ok = calculate_function($fname, \@operand, \$errortext, \%typelookup, \%sheetdata);

DESCRIPTION

This provides all the spreadsheet functions (SUM, MAX, IRR, ISNULL, etc).

EXTENDING

register

  Spreadsheet::Engine->register(SUM => 'Spreadsheet::Engine::Function::SUM');

If you wish to make a new function available you should register it here. A series of base classes are provided that do all the argument checking etc., allowing you to concentrate on the calculations. Have a look at how the existing functions are implemented for details (it should hopefully be mostly self-explanatory!)

information on how many arguments should be passed:

EXPORTS

calculate_function

  my $ok = calculate_function($fname, \@operand, \$errortext, \%typelookup, \%sheetdata);

FUNCTION providers

series_functions

AVERAGE(v1,c1:c2,...) - See <Spreadsheet::Engine::Function::AVERAGE>
COUNT(v1,c1:c2,...) - See <Spreadsheet::Engine::Function::COUNT>
COUNTA(v1,c1:c2,...) - See <Spreadsheet::Engine::Function::COUNTA>
COUNTBLANK(v1,c1:c2,...) - See <Spreadsheet::Engine::Function::COUNTBLANK>
MAX(v1,c1:c2,...) - See Spreadsheet::Engine::Function::MAX
MIN(v1,c1:c2,...) - See Spreadsheet::Engine::Function::MIN
PRODUCT(v1,c1:c2,...) - See Spreadsheet::Engine::Function::PRODUCT
STDEV(v1,c1:c2,...) - See Spreadsheet::Engine::Function::STDEV
STDEVP(v1,c1:c2,...) - See Spreadsheet::Engine::Function::STDEVP
SUM(v1,c1:c2,...) - See Spreadsheet::Engine::Function::SUM
VAR(v1,c1:c2,...) - See Spreadsheet::Engine::Function::VAR
VARP(v1,c1:c2,...) - See Spreadsheet::Engine::Function::VARP

dseries_functions

DAVERAGE(databaserange, fieldname, criteriarange)
DCOUNT(databaserange, fieldname, criteriarange)
DCOUNTA(databaserange, fieldname, criteriarange)
DGET(databaserange, fieldname, criteriarange)
DMAX(databaserange, fieldname, criteriarange)
DMIN(databaserange, fieldname, criteriarange)
DPRODUCT(databaserange, fieldname, criteriarange)
DSTDEV(databaserange, fieldname, criteriarange)
DSTDEVP(databaserange, fieldname, criteriarange)
DSUM(databaserange, fieldname, criteriarange)
DVAR(databaserange, fieldname, criteriarange)
DVARP(databaserange, fieldname, criteriarange)

lookup_functions

HLOOKUP(value, range, row, [rangelookup])
VLOOKUP(value, range, col, [rangelookup])
MATCH(value, range, [rangelookup])

index_function

INDEX(range, rownum, colnum)

countif_sumif_functions

COUNTIF(c1:c2,"criteria")
SUMIF(c1:c2,"criteria")

if_function

IF(cond,truevalue,falsevalue)

exact_function

EXACT(v1,v2)

and_or_function

AND(v1,c1:c2,...)
OR(v1,c1:c2,...)

not_function

NOT(value)

choose_function

CHOOSE(index,value1,value2,...)

columns_rows_function

COLUMNS(c1:c2)
ROWS(c1:c2)

zeroarg_functions

NOW()
TODAY()

irr_function

IRR(c1:c2,[guess])

text_function

PLAINTEXT

html_function

HTML

HELPERS

field_to_colnum

  $colnum = field_to_colnum(\@sheetdata, $col1num, $ncols, $row1num, $fieldname, $fieldtype)

If fieldname is a number, uses it, otherwise looks up string in cells in row to find field number

If not found, returns 0.

HISTORY

This is a Modified Version of SocialCalc::Functions from SocialCalc 1.1.0

COPYRIGHT

Portions (c) Copyright 2005, 2006, 2007 Software Garden, Inc. All Rights Reserved.

Portions (c) Copyright 2007 Socialtext, Inc. All Rights Reserved.

Portions (c) Copyright 2007, 2008 Tony Bowden

LICENCE

The contents of this file are subject to the Artistic License 2.0; you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.perlfoundation.org/artistic_license_2_0