Powered by jsDelivr, you can use the latest version of Formula.js:
<script src="https://firstname.lastname@example.org/dist/jstat.min.js"></script> <script src="https://email@example.com/dist/formula.min.js"></script>
Install the package:
npm i @formulajs/formulajs
Play with it
You can review some usages and play online on the functions pages.
Considering the following spreadsheet:
The Formula.js equivalent would be:
// =SUM(A1:C1) formulajs.SUM([1, 2 , 3]) // returns > 6 // =SUM(A1:C2) formulajs.SUM([[1, 2 , 3], [4, 5, 6]]) // returns > 21
Formula.js tries to recreate the formula you know and like from your spreadsheet tool. However the two environments differs from each other.
=2^3 is a valid Excel function that will return
1, you can learn more here why). With Formula.js you
formulajs.POWER(2, 3) which is equivalent to
If you were previously using formulajs from Sutoiku, some functions have been removed, due to dependency simplification.
FIXED, TEXT, DOLLAR, VALUE
MDETERM, MINVERSE, MMULT, MUNIT
Otherwise the 2 packages are fully compatible. You can swap them.
The code of this package is originally forked from @handsontable/formulajs version 2.0.2 (released in January 2020). The two packages were identical at the time. There is no regression, only fixes and new functions since the fork.