diff --git a/CHANGELOG.md b/CHANGELOG.md
index 65443b4b2e..e66981e66c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added 9 text functions EXACT, LOWER, UPPER, MID, T, SUBSTITUTE, REPLACE, UNICODE, UNICHAR. (#159)
- Added 5 datetime functions: INTERVAL, NETWORKDAYS, NETWORKDAYS.INTL, WORKDAY, WORKDAY.INTL. (#153)
- Added 3 information functions HLOOKUP, ROW, COLUMN. (#158)
+- Added 12 statistical functions VAR.P, VAR.S, VARA, VARPA, STDEV.P, STDEV.S, STDEVA, STDEVPA, VARP, VAR, STDEVP, STDEV.
+- Added 2 mathematical functions SUBTOTAL, PRODUCT.
- Added 15 operator functions HF.ADD, HF.CONCAT, HF.DIVIDE, HF.EQ, HF.GT, HF.GTE, HF.LT, HF.LTE, HF.MINUS, HF.MULTIPLY, HF.NE, HF.POW, HF.UMINUS, HF.UNARY_PERCENT, HF.UPLUS.
### Fixed
diff --git a/docs/guide/built-in-functions.md b/docs/guide/built-in-functions.md
index d5fdd66848..c2cb4f9917 100644
--- a/docs/guide/built-in-functions.md
+++ b/docs/guide/built-in-functions.md
@@ -212,6 +212,7 @@ lets you design your own [custom functions](custom-functions).
| ODD | Math and trigonometry | Rounds a positive number up to the nearest odd integer and a negative number down to the nearest odd integer. | ODD(Number) |
| PI | Math and trigonometry | Returns 3.14159265358979, the value of the mathematical constant PI to 14 decimal places. | PI() |
| POWER | Math and trigonometry | Returns a number raised to another number. | POWER(Base; Exponent) |
+| PRODUCT | Math and trigonometry | Returns product of numbers. | PRODUCT(Number1; Number2; ...; Number30) |
| RADIANS | Math and trigonometry | Converts degrees to radians. | RADIANS(Number) |
| RAND | Math and trigonometry | Returns a random number between 0 and 1. | RAND() |
| ROUND | Math and trigonometry | Rounds a number to a certain number of decimal places. | ROUND(Number; Count) |
@@ -222,6 +223,7 @@ lets you design your own [custom functions](custom-functions).
| SIN | Math and trigonometry | Returns the sine of the given angle (in radians). | SIN(Number) |
| SINH
| Math and trigonometry | Returns the hyperbolic sine of the given value. | SINH(Number) |
| SQRT | Math and trigonometry | Returns the positive square root of a number. | SQRT(Number) |
+| SUBTOTAL | Math and trigonometry | Computes aggregation using function specified by number. | SUBTOTAL(Function; Number1; Number2; ... Number30) |
| SUM | Math and trigonometry | Adds all the numbers in a range of cells. | SUM(Number1; Number2; ...; Number30) |
| SUMIF | Math and trigonometry | Adds the cells specified by given criteria. | SUMIF(Range; Criteria; Sumrange) |
| SUMIFS | Math and trigonometry | Returns the sum of the values of cells in a range that meets multiple criteria in multiple ranges. | SUMIFS(Sum_Range ; Criterion_range1 ; Criterion1 [ ; Criterion_range2 ; Criterion2 [;...]]) |
@@ -248,6 +250,18 @@ lets you design your own [custom functions](custom-functions).
| MEDIAN | Statistical | Returns the median of a set of numbers. | MEDIAN(Number1; Number2; ...Number30) |
| MIN | Statistical | Returns the minimum value in a list of arguments. | MIN(Number1; Number2; ...Number30) |
| MINA | Statistical | Returns the minimum value in a list of arguments. | MINA(Value1; Value2; ... Value30) |
+| STDEV | Statistical | Returns standard deviation of a sample. | STDEV(Value1; Value2; ... Value30) |
+| STDEVA | Statistical | Returns standard deviation of a sample. | STDEVA(Value1; Value2; ... Value30) |
+| STDEVP | Statistical | Returns standard deviation of a population. | STDEVP(Value1; Value2; ... Value30) |
+| STDEV.P | Statistical | Returns standard deviation of a population. | STDEV.P(Value1; Value2; ... Value30) |
+| STDEVPA | Statistical | Returns standard deviation of a population. | STDEVPA(Value1; Value2; ... Value30) |
+| STDEV.S | Statistical | Returns standard deviation of a sample. | STDEV.S(Value1; Value2; ... Value30) |
+| VAR | Statistical | Returns variance of a sample. | VAR(Value1; Value2; ... Value30) |
+| VARA | Statistical | Returns variance of a sample. | VARA(Value1; Value2; ... Value30) |
+| VARP | Statistical | Returns variance of a population. | VARP(Value1; Value2; ... Value30) |
+| VAR.P | Statistical | Returns variance of a population. | VAR.P(Value1; Value2; ... Value30) |
+| VARPA | Statistical | Returns variance of a population. | VARPA(Value1; Value2; ... Value30) |
+| VAR.S | Statistical | Returns variance of a sample. | VAR.S(Value1; Value2; ... Value30) |
| CHAR | Text | Converts a number into a character according to the current code table. | CHAR(Number) |
| CLEAN
| Text | Returns text that has been "cleaned" of line breaks and other non-printable characters. | CLEAN("Text") |
| CLEAN | Text | Returns text that has been "cleaned" of line breaks and other non-printable characters. | CLEAN("Text") |
diff --git a/docs/guide/known-limitations.md b/docs/guide/known-limitations.md
index 43c5b9c229..5dc112c9c6 100644
--- a/docs/guide/known-limitations.md
+++ b/docs/guide/known-limitations.md
@@ -34,4 +34,6 @@ you can't compare the arguments in a formula like this:
* Asynchronous functions
* Structured references ("Tables")
* Currency data type
- * Relative named expressions
\ No newline at end of file
+ * Relative named expressions
+ * Functions cannot use UI metadata (e.g. hidden rows for SUBTOTAL).
+ * SUBTOTAL function does not ignore nested subtotals.
diff --git a/src/i18n/languages/csCZ.ts b/src/i18n/languages/csCZ.ts
index 1858fbc262..cb5387daa0 100644
--- a/src/i18n/languages/csCZ.ts
+++ b/src/i18n/languages/csCZ.ts
@@ -153,7 +153,7 @@ const dictionary: RawTranslationPackage = {
OR: 'NEBO',
PI: 'PI',
PMT: 'PLATBA',
- SUBSTITUTE: 'DOSADIT',
+ PRODUCT: 'SOUČIN',
POWER: 'POWER',
PPMT: 'PLATBA.ZÁKLAD',
PROPER: 'VELKÁ2',
@@ -161,6 +161,7 @@ const dictionary: RawTranslationPackage = {
RADIANS: 'RADIANS',
RAND: 'NÁHČÍSLO',
RATE: 'ÚROKOVÁ.MÍRA',
+ REPLACE: 'NAHRADIT',
REPT: 'OPAKOVAT',
RIGHT: 'ZPRAVA',
ROUND: 'ZAOKROUHLIT',
@@ -180,6 +181,12 @@ const dictionary: RawTranslationPackage = {
SLN: 'ODPIS.LIN',
SPLIT: 'SPLIT',
SQRT: 'ODMOCNINA',
+ STDEVA: 'STDEVA',
+ 'STDEV.P': 'SMODCH.P',
+ STDEVPA: 'STDEVPA',
+ 'STDEV.S': 'SMODCH.VÝBĚR.S',
+ SUBSTITUTE: 'DOSADIT',
+ SUBTOTAL: 'SUBTOTAL',
SUM: 'SUMA',
SUMIF: 'SUMIF',
SUMIFS: 'SUMIFS',
@@ -204,6 +211,10 @@ const dictionary: RawTranslationPackage = {
UNICHAR: 'UNICHAR',
UNICODE: 'UNICODE',
UPPER: 'VELKÁ',
+ VARA: 'VARA',
+ 'VAR.P': 'VAR.P',
+ VARPA: 'VARPA',
+ 'VAR.S': 'VAR.S',
VLOOKUP: 'SVYHLEDAT',
WEEKDAY: 'DENTÝDNE',
WEEKNUM: 'WEEKNUM',
@@ -212,7 +223,6 @@ const dictionary: RawTranslationPackage = {
XOR: 'XOR',
YEAR: 'ROK',
YEARFRAC: 'YEARFRAC',
- REPLACE: 'NAHRADIT',
'HF.ADD': 'HF.ADD',
'HF.CONCAT': 'HF.CONCAT',
'HF.DIVIDE': 'HF.DIVIDE',
@@ -228,6 +238,10 @@ const dictionary: RawTranslationPackage = {
'HF.UMINUS': 'HF.UMINUS',
'HF.UNARY_PERCENT': 'HF.UNARY_PERCENT',
'HF.UPLUS': 'HF.UPLUS',
+ VAR: 'VAR.VÝBĚR',
+ VARP: 'VAR',
+ STDEV: 'SMODCH.VÝBĚR',
+ STDEVP: 'SMODCH',
},
langCode: 'csCZ',
ui: {
diff --git a/src/i18n/languages/daDK.ts b/src/i18n/languages/daDK.ts
index 3c29b9aa8f..26428f7dee 100644
--- a/src/i18n/languages/daDK.ts
+++ b/src/i18n/languages/daDK.ts
@@ -153,7 +153,7 @@ const dictionary: RawTranslationPackage = {
OR: 'ELLER',
PI: 'PI',
PMT: 'YDELSE',
- SUBSTITUTE: 'UDSKIFT',
+ PRODUCT: 'PRODUKT',
POWER: 'POTENS',
PPMT: 'H.YDELSE',
PROPER: 'STORT.FORBOGSTAV',
@@ -161,6 +161,7 @@ const dictionary: RawTranslationPackage = {
RADIANS: 'RADIANER',
RAND: 'SLUMP',
RATE: 'RENTE',
+ REPLACE: 'ERSTAT',
REPT: 'GENTAG',
RIGHT: 'HØJRE',
ROUND: 'AFRUND',
@@ -180,6 +181,12 @@ const dictionary: RawTranslationPackage = {
SLN: 'LA',
SPLIT: 'SPLIT',
SQRT: 'KVROD',
+ STDEVA: 'STDAFVV',
+ 'STDEV.P': 'STDAFV.P',
+ STDEVPA: 'STDAFVPV',
+ 'STDEV.S': 'STDAFV.S',
+ SUBSTITUTE: 'UDSKIFT',
+ SUBTOTAL: 'SUBTOTAL',
SUM: 'SUM',
SUMIF: 'SUM.HVIS',
SUMIFS: 'SUM.HVISER',
@@ -204,6 +211,10 @@ const dictionary: RawTranslationPackage = {
UNICHAR: 'UNICHAR',
UNICODE: 'UNICODE',
UPPER: 'STORE.BOGSTAVER',
+ VARA: 'VARIANSV',
+ 'VAR.P': 'VARIANS.P',
+ VARPA: 'VARIANSPV',
+ 'VAR.S': 'VARIANS.S',
VLOOKUP: 'LOPSLAG',
WEEKDAY: 'UGEDAG',
WEEKNUM: 'UGE.NR',
@@ -212,7 +223,6 @@ const dictionary: RawTranslationPackage = {
XOR: 'XELLER',
YEAR: 'ÅR',
YEARFRAC: 'ÅR.BRØK',
- REPLACE: 'ERSTAT',
'HF.ADD': 'HF.ADD',
'HF.CONCAT': 'HF.CONCAT',
'HF.DIVIDE': 'HF.DIVIDE',
@@ -228,6 +238,10 @@ const dictionary: RawTranslationPackage = {
'HF.UMINUS': 'HF.UMINUS',
'HF.UNARY_PERCENT': 'HF.UNARY_PERCENT',
'HF.UPLUS': 'HF.UPLUS',
+ VAR: 'VARIANS',
+ VARP: 'VARIANSP',
+ STDEV: 'STDAFV',
+ STDEVP: 'STDAFVP',
},
langCode: 'daDK',
ui: {
diff --git a/src/i18n/languages/deDE.ts b/src/i18n/languages/deDE.ts
index 802151ff2f..17213f44fd 100644
--- a/src/i18n/languages/deDE.ts
+++ b/src/i18n/languages/deDE.ts
@@ -153,7 +153,7 @@ const dictionary: RawTranslationPackage = {
OR: 'ODER',
PI: 'PI',
PMT: 'RMZ',
- SUBSTITUTE: 'WECHSELN',
+ PRODUCT: 'PRODUKT',
POWER: 'POTENZ',
PPMT: 'KAPZ',
PROPER: 'GROSS2',
@@ -161,6 +161,7 @@ const dictionary: RawTranslationPackage = {
RADIANS: 'BOGENMASS',
RAND: 'ZUFALLSZAHL',
RATE: 'ZINS',
+ REPLACE: 'ERSETZEN',
REPT: 'WIEDERHOLEN',
RIGHT: 'RECHTS',
ROUND: 'RUNDEN',
@@ -180,6 +181,12 @@ const dictionary: RawTranslationPackage = {
SLN: 'LIA',
SPLIT: 'SPLIT',
SQRT: 'WURZEL',
+ STDEVA: 'STABWA',
+ 'STDEV.P': 'STABW.N',
+ STDEVPA: 'STABWNA',
+ 'STDEV.S': 'STABW.S',
+ SUBSTITUTE: 'WECHSELN',
+ SUBTOTAL: 'TEILERGEBNIS',
SUM: 'SUMME',
SUMIF: 'SUMMEWENN',
SUMIFS: 'SUMMEWENNS',
@@ -204,6 +211,10 @@ const dictionary: RawTranslationPackage = {
UNICHAR: 'UNIZEICHEN',
UNICODE: 'UNICODE',
UPPER: 'GROSS',
+ VARA: 'VARIANZA',
+ 'VAR.P': 'VAR.P',
+ VARPA: 'VARIANZENA',
+ 'VAR.S': 'VAR.S',
VLOOKUP: 'SVERWEIS',
WEEKDAY: 'WOCHENTAG',
WEEKNUM: 'KALENDERWOCHE',
@@ -212,7 +223,6 @@ const dictionary: RawTranslationPackage = {
XOR: 'XODER',
YEAR: 'JAHR',
YEARFRAC: 'BRTEILJAHRE',
- REPLACE: 'ERSETZEN',
'HF.ADD': 'HF.ADD',
'HF.CONCAT': 'HF.CONCAT',
'HF.DIVIDE': 'HF.DIVIDE',
@@ -228,6 +238,10 @@ const dictionary: RawTranslationPackage = {
'HF.UMINUS': 'HF.UMINUS',
'HF.UNARY_PERCENT': 'HF.UNARY_PERCENT',
'HF.UPLUS': 'HF.UPLUS',
+ VAR: 'VARIANZ',
+ VARP: 'VARIANZEN',
+ STDEV: 'STABW',
+ STDEVP: 'STABWN',
},
langCode: 'deDE',
ui: {
diff --git a/src/i18n/languages/enGB.ts b/src/i18n/languages/enGB.ts
index d45cda6adc..0a102fa429 100644
--- a/src/i18n/languages/enGB.ts
+++ b/src/i18n/languages/enGB.ts
@@ -153,7 +153,7 @@ const dictionary: RawTranslationPackage = {
OR: 'OR',
PI: 'PI',
PMT: 'PMT',
- SUBSTITUTE: 'SUBSTITUTE',
+ PRODUCT: 'PRODUCT',
POWER: 'POWER',
PPMT: 'PPMT',
PROPER: 'PROPER',
@@ -161,6 +161,7 @@ const dictionary: RawTranslationPackage = {
RADIANS: 'RADIANS',
RAND: 'RAND',
RATE: 'RATE',
+ REPLACE: 'REPLACE',
REPT: 'REPT',
RIGHT: 'RIGHT',
ROUND: 'ROUND',
@@ -180,6 +181,12 @@ const dictionary: RawTranslationPackage = {
SLN: 'SLN',
SPLIT: 'SPLIT',
SQRT: 'SQRT',
+ STDEVA: 'STDEVA',
+ 'STDEV.P': 'STDEV.P',
+ STDEVPA: 'STDEVPA',
+ 'STDEV.S': 'STDEV.S',
+ SUBSTITUTE: 'SUBSTITUTE',
+ SUBTOTAL: 'SUBTOTAL',
SUM: 'SUM',
SUMIF: 'SUMIF',
SUMIFS: 'SUMIFS',
@@ -204,6 +211,10 @@ const dictionary: RawTranslationPackage = {
UNICHAR: 'UNICHAR',
UNICODE: 'UNICODE',
UPPER: 'UPPER',
+ VARA: 'VARA',
+ 'VAR.P': 'VAR.P',
+ VARPA: 'VARPA',
+ 'VAR.S': 'VAR.S',
VLOOKUP: 'VLOOKUP',
WEEKDAY: 'WEEKDAY',
WEEKNUM: 'WEEKNUM',
@@ -212,7 +223,6 @@ const dictionary: RawTranslationPackage = {
XOR: 'XOR',
YEAR: 'YEAR',
YEARFRAC: 'YEARFRAC',
- REPLACE: 'REPLACE',
'HF.ADD': 'HF.ADD',
'HF.CONCAT': 'HF.CONCAT',
'HF.DIVIDE': 'HF.DIVIDE',
@@ -228,6 +238,10 @@ const dictionary: RawTranslationPackage = {
'HF.UMINUS': 'HF.UMINUS',
'HF.UNARY_PERCENT': 'HF.UNARY_PERCENT',
'HF.UPLUS': 'HF.UPLUS',
+ VARP: 'VARP',
+ VAR: 'VAR',
+ STDEVP: 'STDEVP',
+ STDEV: 'STDEV'
},
langCode: 'enGB',
ui: {
diff --git a/src/i18n/languages/esES.ts b/src/i18n/languages/esES.ts
index 38c34211fa..e7f8968934 100644
--- a/src/i18n/languages/esES.ts
+++ b/src/i18n/languages/esES.ts
@@ -153,7 +153,7 @@ export const dictionary: RawTranslationPackage = {
OR: 'O',
PI: 'PI',
PMT: 'PAGO',
- SUBSTITUTE: 'SUSTITUIR',
+ PRODUCT: 'PRODUCTO',
POWER: 'POTENCIA',
PPMT: 'PAGOPRIN',
PROPER: 'NOMPROPIO',
@@ -161,6 +161,7 @@ export const dictionary: RawTranslationPackage = {
RADIANS: 'RADIANES',
RAND: 'ALEATORIO',
RATE: 'TASA',
+ REPLACE: 'REEMPLAZAR',
REPT: 'REPETIR',
RIGHT: 'DERECHA',
ROUND: 'REDONDEAR',
@@ -180,6 +181,12 @@ export const dictionary: RawTranslationPackage = {
SLN: 'SLN',
SPLIT: 'SPLIT',
SQRT: 'RAIZ',
+ STDEVA: 'DESVESTA',
+ 'STDEV.P': 'DESVEST.P',
+ STDEVPA: 'DESVESTPA',
+ 'STDEV.S': 'DESVEST.M',
+ SUBSTITUTE: 'SUSTITUIR',
+ SUBTOTAL: 'SUBTOTALES',
SUM: 'SUMA',
SUMIF: 'SUMAR.SI',
SUMIFS: 'SUMAR.SI.CONJUNTO',
@@ -204,6 +211,10 @@ export const dictionary: RawTranslationPackage = {
UNICHAR: 'UNICHAR',
UNICODE: 'UNICODE',
UPPER: 'MAYUSC',
+ VARA: 'VARA',
+ 'VAR.P': 'VAR.P',
+ VARPA: 'VARPA',
+ 'VAR.S': 'VAR.S',
VLOOKUP: 'BUSCARV',
WEEKDAY: 'DIASEM',
WEEKNUM: 'NUM.DE.SEMANA',
@@ -212,7 +223,6 @@ export const dictionary: RawTranslationPackage = {
XOR: 'XOR',
YEAR: 'AÑO',
YEARFRAC: 'FRAC.AÑO',
- REPLACE: 'REEMPLAZAR',
'HF.ADD': 'HF.ADD',
'HF.CONCAT': 'HF.CONCAT',
'HF.DIVIDE': 'HF.DIVIDE',
@@ -228,6 +238,10 @@ export const dictionary: RawTranslationPackage = {
'HF.UMINUS': 'HF.UMINUS',
'HF.UNARY_PERCENT': 'HF.UNARY_PERCENT',
'HF.UPLUS': 'HF.UPLUS',
+ VAR: 'VAR',
+ VARP: 'VARP',
+ STDEV: 'DESVEST',
+ STDEVP: 'DESVESTP',
},
langCode: 'esES',
ui: {
diff --git a/src/i18n/languages/fiFI.ts b/src/i18n/languages/fiFI.ts
index 2be3cc487b..7999cfe9cd 100644
--- a/src/i18n/languages/fiFI.ts
+++ b/src/i18n/languages/fiFI.ts
@@ -153,7 +153,7 @@ const dictionary: RawTranslationPackage = {
OR: 'TAI',
PI: 'PII',
PMT: 'MAKSU',
- SUBSTITUTE: 'VAIHDA',
+ PRODUCT: 'TULO',
POWER: 'POTENSSI',
PPMT: 'PPMT',
PROPER: 'ERISNIMI',
@@ -161,6 +161,7 @@ const dictionary: RawTranslationPackage = {
RADIANS: 'RADIAANIT',
RAND: 'SATUNNAISLUKU',
RATE: 'KORKO',
+ REPLACE: 'KORVAA',
REPT: 'TOISTA',
RIGHT: 'OIKEA',
ROUND: 'PYÖRISTÄ',
@@ -180,6 +181,12 @@ const dictionary: RawTranslationPackage = {
SLN: 'STP',
SPLIT: 'SPLIT',
SQRT: 'NELIÖJUURI',
+ STDEVA: 'KESKIHAJONTAA',
+ 'STDEV.P': 'KESKIHAJONTA.P',
+ STDEVPA: 'KESKIHAJONTAPA',
+ 'STDEV.S': 'KESKIHAJONTA.S',
+ SUBSTITUTE: 'VAIHDA',
+ SUBTOTAL: 'VÄLISUMMA',
SUM: 'SUMMA',
SUMIF: 'SUMMA.JOS',
SUMIFS: 'SUMMA.JOS.JOUKKO',
@@ -204,6 +211,10 @@ const dictionary: RawTranslationPackage = {
UNICHAR: 'UNICODEMERKKI',
UNICODE: 'UNICODE',
UPPER: 'ISOT',
+ VARA: 'VARA',
+ 'VAR.P': 'VAR.P',
+ VARPA: 'VARPA',
+ 'VAR.S': 'VAR.S',
VLOOKUP: 'PHAKU',
WEEKDAY: 'VIIKONPÄIVÄ',
WEEKNUM: 'VIIKKO.NRO',
@@ -212,7 +223,6 @@ const dictionary: RawTranslationPackage = {
XOR: 'EHDOTON.TAI',
YEAR: 'VUOSI',
YEARFRAC: 'VUOSI.OSA',
- REPLACE: 'KORVAA',
'HF.ADD': 'HF.ADD',
'HF.CONCAT': 'HF.CONCAT',
'HF.DIVIDE': 'HF.DIVIDE',
@@ -228,6 +238,10 @@ const dictionary: RawTranslationPackage = {
'HF.UMINUS': 'HF.UMINUS',
'HF.UNARY_PERCENT': 'HF.UNARY_PERCENT',
'HF.UPLUS': 'HF.UPLUS',
+ VAR: 'VAR',
+ VARP: 'VARP',
+ STDEV: 'KESKIHAJONTA',
+ STDEVP: 'KESKIHAJONTAP',
},
langCode: 'fiFI',
ui: {
diff --git a/src/i18n/languages/frFR.ts b/src/i18n/languages/frFR.ts
index 039092b405..ae2f566d88 100644
--- a/src/i18n/languages/frFR.ts
+++ b/src/i18n/languages/frFR.ts
@@ -153,7 +153,7 @@ const dictionary: RawTranslationPackage = {
OR: 'OU',
PI: 'PI',
PMT: 'VPM',
- SUBSTITUTE: 'SUBSTITUE',
+ PRODUCT: 'PRODUIT',
POWER: 'PUISSANCE',
PPMT: 'PRINCPER',
PROPER: 'NOMPROPRE',
@@ -161,6 +161,7 @@ const dictionary: RawTranslationPackage = {
RADIANS: 'RADIANS',
RAND: 'ALEA',
RATE: 'TAUX',
+ REPLACE: 'REMPLACER',
REPT: 'REPT',
RIGHT: 'DROITE',
ROUND: 'ARRONDI',
@@ -180,6 +181,12 @@ const dictionary: RawTranslationPackage = {
SLN: 'AMORLIN',
SPLIT: 'SPLIT',
SQRT: 'RACINE',
+ STDEVA: 'STDEVA',
+ 'STDEV.P': 'ECARTYPE.PEARSON',
+ STDEVPA: 'STDEVPA',
+ 'STDEV.S': 'ECARTYPE.STANDARD',
+ SUBSTITUTE: 'SUBSTITUE',
+ SUBTOTAL: 'SOUS.TOTAL',
SUM: 'SOMME',
SUMIF: 'SOMME.SI',
SUMIFS: 'SOMME.SI.ENS',
@@ -204,6 +211,10 @@ const dictionary: RawTranslationPackage = {
UNICHAR: 'UNICAR',
UNICODE: 'UNICODE',
UPPER: 'MAJUSCULE',
+ VARA: 'VARA',
+ 'VAR.P': 'VAR.P.N',
+ VARPA: 'VARPA',
+ 'VAR.S': 'VAR.S',
VLOOKUP: 'RECHERCHEV',
WEEKDAY: 'JOURSEM',
WEEKNUM: 'NO.SEMAINE',
@@ -212,7 +223,6 @@ const dictionary: RawTranslationPackage = {
XOR: 'OUX',
YEAR: 'ANNEE',
YEARFRAC: 'FRACTION.ANNEE',
- REPLACE: 'REMPLACER',
'HF.ADD': 'HF.ADD',
'HF.CONCAT': 'HF.CONCAT',
'HF.DIVIDE': 'HF.DIVIDE',
@@ -228,6 +238,10 @@ const dictionary: RawTranslationPackage = {
'HF.UMINUS': 'HF.UMINUS',
'HF.UNARY_PERCENT': 'HF.UNARY_PERCENT',
'HF.UPLUS': 'HF.UPLUS',
+ VAR: 'VAR',
+ VARP: 'VAR.P',
+ STDEV: 'ECARTYPE',
+ STDEVP: 'ECARTYPEP',
},
langCode: 'frFR',
ui: {
diff --git a/src/i18n/languages/huHU.ts b/src/i18n/languages/huHU.ts
index fc53f09cf4..a964eb27b5 100644
--- a/src/i18n/languages/huHU.ts
+++ b/src/i18n/languages/huHU.ts
@@ -153,7 +153,7 @@ const dictionary: RawTranslationPackage = {
OR: 'VAGY',
PI: 'PI',
PMT: 'RÉSZLET',
- SUBSTITUTE: 'HELYETTE',
+ PRODUCT: 'SZORZAT',
POWER: 'HATVÁNY',
PPMT: 'PRÉSZLET',
PROPER: 'TNÉV',
@@ -161,6 +161,7 @@ const dictionary: RawTranslationPackage = {
RADIANS: 'RADIÁN',
RAND: 'VÉL',
RATE: 'RÁTA',
+ REPLACE: 'CSERE',
REPT: 'SOKSZOR',
RIGHT: 'JOBB',
ROUND: 'KEREKÍTÉS',
@@ -180,6 +181,12 @@ const dictionary: RawTranslationPackage = {
SLN: 'LCSA',
SPLIT: 'SPLIT',
SQRT: 'GYÖK',
+ STDEVA: 'SZÓRÁSA',
+ 'STDEV.P': 'SZÓR.S',
+ STDEVPA: 'SZÓRÁSPA',
+ 'STDEV.S': 'SZÓR.M',
+ SUBSTITUTE: 'HELYETTE',
+ SUBTOTAL: 'RÉSZÖSSZEG',
SUM: 'SZUM',
SUMIF: 'SZUMHA',
SUMIFS: 'SZUMHATÖBB',
@@ -204,6 +211,10 @@ const dictionary: RawTranslationPackage = {
UNICHAR: 'UNIKARAKTER',
UNICODE: 'UNICODE',
UPPER: 'NAGYBETŰS',
+ VARA: 'VARA',
+ 'VAR.P': 'VAR.S',
+ VARPA: 'VARPA',
+ 'VAR.S': 'VAR.M',
VLOOKUP: 'FKERES',
WEEKDAY: 'HÉT.NAPJA',
WEEKNUM: 'HÉT.SZÁMA',
@@ -212,7 +223,6 @@ const dictionary: RawTranslationPackage = {
XOR: 'XVAGY',
YEAR: 'ÉV',
YEARFRAC: 'TÖRTÉV',
- REPLACE: 'CSERE',
'HF.ADD': 'HF.ADD',
'HF.CONCAT': 'HF.CONCAT',
'HF.DIVIDE': 'HF.DIVIDE',
@@ -228,6 +238,10 @@ const dictionary: RawTranslationPackage = {
'HF.UMINUS': 'HF.UMINUS',
'HF.UNARY_PERCENT': 'HF.UNARY_PERCENT',
'HF.UPLUS': 'HF.UPLUS',
+ VAR: 'VAR',
+ VARP: 'VARP',
+ STDEV: 'SZÓRÁS',
+ STDEVP: 'SZÓRÁSP',
},
langCode: 'huHU',
ui: {
diff --git a/src/i18n/languages/itIT.ts b/src/i18n/languages/itIT.ts
index d46d9c2770..e7e54a7227 100644
--- a/src/i18n/languages/itIT.ts
+++ b/src/i18n/languages/itIT.ts
@@ -153,7 +153,7 @@ const dictionary: RawTranslationPackage = {
OR: 'O',
PI: 'PI.GRECO',
PMT: 'RATA',
- SUBSTITUTE: 'SOSTITUISCI',
+ PRODUCT: 'PRODOTTO',
POWER: 'POTENZA',
PPMT: 'P.RATA',
PROPER: 'MAIUSC.INIZ',
@@ -161,6 +161,7 @@ const dictionary: RawTranslationPackage = {
RADIANS: 'RADIANTI',
RAND: 'CASUALE',
RATE: 'TASSO',
+ REPLACE: 'RIMPIAZZA',
REPT: 'RIPETI',
RIGHT: 'DESTRA',
ROUND: 'ARROTONDA',
@@ -180,6 +181,12 @@ const dictionary: RawTranslationPackage = {
SLN: 'AMMORT.COST',
SPLIT: 'SPLIT',
SQRT: 'RADQ',
+ STDEVA: 'DEV.ST.VALORI',
+ 'STDEV.P': 'DEV.ST.P',
+ STDEVPA: 'DEV.ST.POP.VALORI',
+ 'STDEV.S': 'DEV.ST.C',
+ SUBSTITUTE: 'SOSTITUISCI',
+ SUBTOTAL: 'SUBTOTALE',
SUM: 'SOMMA',
SUMIF: 'SOMMA.SE',
SUMIFS: 'SOMMA.PIÙ.SE',
@@ -204,6 +211,10 @@ const dictionary: RawTranslationPackage = {
UNICHAR: 'CARATT.UNI',
UNICODE: 'UNICODE',
UPPER: 'MAIUSC',
+ VARA: 'VAR.VALORI',
+ 'VAR.P': 'VAR.P',
+ VARPA: 'VAR.POP.VALORI',
+ 'VAR.S': 'VAR.C',
VLOOKUP: 'CERCA.VERT',
WEEKDAY: 'GIORNO.SETTIMANA',
WEEKNUM: 'NUM.SETTIMANA',
@@ -212,7 +223,6 @@ const dictionary: RawTranslationPackage = {
XOR: 'XOR',
YEAR: 'ANNO',
YEARFRAC: 'FRAZIONE.ANNO',
- REPLACE: 'RIMPIAZZA',
'HF.ADD': 'HF.ADD',
'HF.CONCAT': 'HF.CONCAT',
'HF.DIVIDE': 'HF.DIVIDE',
@@ -228,6 +238,10 @@ const dictionary: RawTranslationPackage = {
'HF.UMINUS': 'HF.UMINUS',
'HF.UNARY_PERCENT': 'HF.UNARY_PERCENT',
'HF.UPLUS': 'HF.UPLUS',
+ VAR: 'VAR',
+ VARP: 'VAR.POP',
+ STDEV: 'DEV.ST',
+ STDEVP: 'DEV.ST.POP',
},
langCode: 'itIT',
ui: {
diff --git a/src/i18n/languages/nbNO.ts b/src/i18n/languages/nbNO.ts
index 64461faf7a..b720910e74 100644
--- a/src/i18n/languages/nbNO.ts
+++ b/src/i18n/languages/nbNO.ts
@@ -153,7 +153,7 @@ const dictionary: RawTranslationPackage = {
OR: 'ELLER',
PI: 'PI',
PMT: 'AVDRAG',
- SUBSTITUTE: 'BYTT.UT',
+ PRODUCT: 'PRODUKT',
POWER: 'OPPHØYD.I',
PPMT: 'AMORT',
PROPER: 'STOR.FORBOKSTAV',
@@ -161,6 +161,7 @@ const dictionary: RawTranslationPackage = {
RADIANS: 'RADIANER',
RAND: 'TILFELDIG',
RATE: 'RENTE',
+ REPLACE: 'ERSTATT',
REPT: 'GJENTA',
RIGHT: 'HØYRE',
ROUND: 'AVRUND',
@@ -180,6 +181,12 @@ const dictionary: RawTranslationPackage = {
SLN: 'LINAVS',
SPLIT: 'SPLIT',
SQRT: 'ROT',
+ STDEVA: 'STDAVVIKA',
+ 'STDEV.P': 'STDAV.P',
+ STDEVPA: 'STDAVVIKPA',
+ 'STDEV.S': 'STDAV.S',
+ SUBSTITUTE: 'BYTT.UT',
+ SUBTOTAL: 'DELSUM',
SUM: 'SUMMER',
SUMIF: 'SUMMERHVIS',
SUMIFS: 'SUMMER.HVIS.SETT',
@@ -204,6 +211,10 @@ const dictionary: RawTranslationPackage = {
UNICHAR: 'UNICODETEGN',
UNICODE: 'UNICODE',
UPPER: 'STORE',
+ VARA: 'VARIANSA',
+ 'VAR.P': 'VARIANS.P',
+ VARPA: 'VARIANSPA',
+ 'VAR.S': 'VARIANS.S',
VLOOKUP: 'FINN.RAD',
WEEKDAY: 'UKEDAG',
WEEKNUM: 'UKENR',
@@ -212,7 +223,6 @@ const dictionary: RawTranslationPackage = {
XOR: 'EKSKLUSIVELLER',
YEAR: 'ÅR',
YEARFRAC: 'ÅRDEL',
- REPLACE: 'ERSTATT',
'HF.ADD': 'HF.ADD',
'HF.CONCAT': 'HF.CONCAT',
'HF.DIVIDE': 'HF.DIVIDE',
@@ -228,6 +238,10 @@ const dictionary: RawTranslationPackage = {
'HF.UMINUS': 'HF.UMINUS',
'HF.UNARY_PERCENT': 'HF.UNARY_PERCENT',
'HF.UPLUS': 'HF.UPLUS',
+ VAR: 'VARIANS',
+ VARP: 'VARIANSP',
+ STDEV: 'STDAV',
+ STDEVP: 'STDAVP',
},
langCode: 'nbNO',
ui: {
diff --git a/src/i18n/languages/nlNL.ts b/src/i18n/languages/nlNL.ts
index 2d2b7e90b7..f5f5260b18 100644
--- a/src/i18n/languages/nlNL.ts
+++ b/src/i18n/languages/nlNL.ts
@@ -153,7 +153,7 @@ const dictionary: RawTranslationPackage = {
OR: 'OF',
PI: 'PI',
PMT: 'BET',
- SUBSTITUTE: 'SUBSTITUEREN',
+ PRODUCT: 'PRODUCT',
POWER: 'MACHT',
PPMT: 'PBET',
PROPER: 'BEGINLETTERS',
@@ -161,6 +161,7 @@ const dictionary: RawTranslationPackage = {
RADIANS: 'RADIALEN',
RAND: 'ASELECT',
RATE: 'RENTE',
+ REPLACE: 'VERVANGEN',
REPT: 'HERHALING',
RIGHT: 'RECHTS',
ROUND: 'AFRONDEN',
@@ -180,6 +181,12 @@ const dictionary: RawTranslationPackage = {
SLN: 'LIN.AFSCHR',
SPLIT: 'SPLIT',
SQRT: 'WORTEL',
+ STDEVA: 'STDEVA',
+ 'STDEV.P': 'STDEV.P',
+ STDEVPA: 'STDEVPA',
+ 'STDEV.S': 'STDEV.S',
+ SUBSTITUTE: 'SUBSTITUEREN',
+ SUBTOTAL: 'SUBTOTAAL',
SUM: 'SOM',
SUMIF: 'SOM.ALS',
SUMIFS: 'SOMMEN.ALS',
@@ -204,6 +211,10 @@ const dictionary: RawTranslationPackage = {
UNICHAR: 'UNITEKEN',
UNICODE: 'UNICODE',
UPPER: 'HOOFDLETTERS',
+ VARA: 'VARA',
+ 'VAR.P': 'VAR.P',
+ VARPA: 'VARPA',
+ 'VAR.S': 'VAR.S',
VLOOKUP: 'VERT.ZOEKEN',
WEEKDAY: 'WEEKDAG',
WEEKNUM: 'WEEKNUMMER',
@@ -212,7 +223,6 @@ const dictionary: RawTranslationPackage = {
XOR: 'EX.OF',
YEAR: 'JAAR',
YEARFRAC: 'JAAR.DEEL',
- REPLACE: 'VERVANGEN',
'HF.ADD': 'HF.ADD',
'HF.CONCAT': 'HF.CONCAT',
'HF.DIVIDE': 'HF.DIVIDE',
@@ -228,6 +238,10 @@ const dictionary: RawTranslationPackage = {
'HF.UMINUS': 'HF.UMINUS',
'HF.UNARY_PERCENT': 'HF.UNARY_PERCENT',
'HF.UPLUS': 'HF.UPLUS',
+ VAR: 'VAR',
+ VARP: 'VARP',
+ STDEV: 'STDEV',
+ STDEVP: 'STDEVP',
},
langCode: 'nlNL',
ui: {
diff --git a/src/i18n/languages/plPL.ts b/src/i18n/languages/plPL.ts
index 2429aad47b..c36e4e405b 100644
--- a/src/i18n/languages/plPL.ts
+++ b/src/i18n/languages/plPL.ts
@@ -153,7 +153,7 @@ const dictionary: RawTranslationPackage = {
OR: 'LUB',
PI: 'PI',
PMT: 'PMT',
- SUBSTITUTE: 'PODSTAW',
+ PRODUCT: 'ILOCZYN',
POWER: 'POTĘGA',
PPMT: 'PPMT',
PROPER: 'Z.WIELKIEJ.LITERY',
@@ -161,6 +161,7 @@ const dictionary: RawTranslationPackage = {
RADIANS: 'RADIANY',
RAND: 'LOSUJ',
RATE: 'RATE',
+ REPLACE: 'ZASTĄP',
REPT: 'POWT',
RIGHT: 'PRAWY',
ROUND: 'ZAOKR',
@@ -180,6 +181,12 @@ const dictionary: RawTranslationPackage = {
SLN: 'SLN',
SPLIT: 'PODZIEL.TEKST',
SQRT: 'PIERWIASTEK',
+ STDEVA: 'ODCH.STANDARDOWE.A',
+ 'STDEV.P': 'ODCH.STAND.POPUL',
+ STDEVPA: 'ODCH.STANDARD.POPUL.A',
+ 'STDEV.S': 'ODCH.STANDARD.PRÓBKI',
+ SUBSTITUTE: 'PODSTAW',
+ SUBTOTAL: 'SUMY.CZĘŚCIOWE',
SUM: 'SUMA',
SUMIF: 'SUMA.JEŻELI',
SUMIFS: 'SUMY.JEŻELI',
@@ -204,6 +211,10 @@ const dictionary: RawTranslationPackage = {
UNICHAR: 'ZNAK.UNICODE',
UNICODE: 'UNICODE',
UPPER: 'LITERY.WIELKIE',
+ VARA: 'WARIANCJA.A',
+ 'VAR.P': 'WARIANCJA.POP',
+ VARPA: 'WARIANCJA.POPUL.A',
+ 'VAR.S': 'WARIANCJA.PRÓBKI',
VLOOKUP: 'WYSZUKAJ.PIONOWO',
WEEKDAY: 'DZIEŃ.TYG',
WEEKNUM: 'NUM.TYG',
@@ -212,7 +223,6 @@ const dictionary: RawTranslationPackage = {
XOR: 'XOR',
YEAR: 'ROK',
YEARFRAC: 'CZĘŚĆ.ROKU',
- REPLACE: 'ZASTĄP',
'HF.ADD': 'HF.ADD',
'HF.CONCAT': 'HF.CONCAT',
'HF.DIVIDE': 'HF.DIVIDE',
@@ -228,6 +238,10 @@ const dictionary: RawTranslationPackage = {
'HF.UMINUS': 'HF.UMINUS',
'HF.UNARY_PERCENT': 'HF.UNARY_PERCENT',
'HF.UPLUS': 'HF.UPLUS',
+ VAR: 'WARIANCJA',
+ VARP: 'WARIANCJA.POPUL',
+ STDEV: 'ODCH.STANDARDOWE',
+ STDEVP: 'ODCH.STANDARD.POPUL',
},
langCode: 'plPL',
ui: {
diff --git a/src/i18n/languages/ptPT.ts b/src/i18n/languages/ptPT.ts
index cbf202712f..90634f5da0 100644
--- a/src/i18n/languages/ptPT.ts
+++ b/src/i18n/languages/ptPT.ts
@@ -153,7 +153,7 @@ const dictionary: RawTranslationPackage = {
OR: 'OU',
PI: 'PI',
PMT: 'PGTO',
- SUBSTITUTE: 'SUBSTITUIR',
+ PRODUCT: 'MULT',
POWER: 'POTÊNCIA',
PPMT: 'PPGTO',
PROPER: 'PRI.MAIÚSCULA',
@@ -161,6 +161,7 @@ const dictionary: RawTranslationPackage = {
RADIANS: 'RADIANOS',
RAND: 'ALEATÓRIO',
RATE: 'TAXA',
+ REPLACE: 'MUDAR',
REPT: 'REPT',
RIGHT: 'DIREITA',
ROUND: 'ARRED',
@@ -180,6 +181,12 @@ const dictionary: RawTranslationPackage = {
SLN: 'DPD',
SPLIT: 'SPLIT',
SQRT: 'RAIZ',
+ STDEVA: 'DESVPADA',
+ 'STDEV.P': 'DESVPAD.P',
+ STDEVPA: 'DESVPADPA',
+ 'STDEV.S': 'DESVPAD.A',
+ SUBSTITUTE: 'SUBSTITUIR',
+ SUBTOTAL: 'SUBTOTAL',
SUM: 'SOMA',
SUMIF: 'SOMASE',
SUMIFS: 'SOMASES',
@@ -204,6 +211,10 @@ const dictionary: RawTranslationPackage = {
UNICHAR: 'CARACTUNI',
UNICODE: 'UNICODE',
UPPER: 'MAIÚSCULA',
+ VARA: 'VARA',
+ 'VAR.P': 'VAR.P',
+ VARPA: 'VARPA',
+ 'VAR.S': 'VAR.A',
VLOOKUP: 'PROCV',
WEEKDAY: 'DIA.DA.SEMANA',
WEEKNUM: 'NÚMSEMANA',
@@ -212,7 +223,6 @@ const dictionary: RawTranslationPackage = {
XOR: 'OUEXCL',
YEAR: 'ANO',
YEARFRAC: 'FRAÇÃOANO',
- REPLACE: 'MUDAR',
'HF.ADD': 'HF.ADD',
'HF.CONCAT': 'HF.CONCAT',
'HF.DIVIDE': 'HF.DIVIDE',
@@ -228,6 +238,10 @@ const dictionary: RawTranslationPackage = {
'HF.UMINUS': 'HF.UMINUS',
'HF.UNARY_PERCENT': 'HF.UNARY_PERCENT',
'HF.UPLUS': 'HF.UPLUS',
+ VAR: 'VAR',
+ VARP: 'VARP',
+ STDEV: 'DESVPAD',
+ STDEVP: 'DESVPADP',
},
langCode: 'ptPT',
ui: {
diff --git a/src/i18n/languages/ruRU.ts b/src/i18n/languages/ruRU.ts
index e7d94ae4a1..43947dc176 100644
--- a/src/i18n/languages/ruRU.ts
+++ b/src/i18n/languages/ruRU.ts
@@ -153,7 +153,7 @@ const dictionary: RawTranslationPackage = {
OR: 'ИЛИ',
PI: 'ПИ',
PMT: 'ПЛТ',
- SUBSTITUTE: 'ПОДСТАВИТЬ',
+ PRODUCT: 'ПРОИЗВЕД',
POWER: 'СТЕПЕНЬ',
PPMT: 'ОСПЛТ',
PROPER: 'ПРОПНАЧ',
@@ -161,6 +161,7 @@ const dictionary: RawTranslationPackage = {
RADIANS: 'РАДИАНЫ',
RAND: 'СЛЧИС',
RATE: 'СТАВКА',
+ REPLACE: 'ЗАМЕНИТЬ',
REPT: 'ПОВТОР',
RIGHT: 'ПРАВСИМВ',
ROUND: 'ОКРУГЛ',
@@ -180,6 +181,12 @@ const dictionary: RawTranslationPackage = {
SLN: 'АПЛ',
SPLIT: 'SPLIT',
SQRT: 'КОРЕНЬ',
+ STDEVA: 'СТАНДОТКЛОНА',
+ 'STDEV.P': 'СТАНДОТКЛОН.Г',
+ STDEVPA: 'СТАНДОТКЛОНПА',
+ 'STDEV.S': 'СТАНДОТКЛОН.В',
+ SUBSTITUTE: 'ПОДСТАВИТЬ',
+ SUBTOTAL: 'ПРОМЕЖУТОЧНЫЕ.ИТОГИ',
SUM: 'СУММ',
SUMIF: 'СУММЕСЛИ',
SUMIFS: 'СУММЕСЛИМН',
@@ -204,6 +211,10 @@ const dictionary: RawTranslationPackage = {
UNICHAR: 'ЮНИСИМВ',
UNICODE: 'UNICODE',
UPPER: 'ПРОПИСН',
+ VARA: 'ДИСПА',
+ 'VAR.P': 'ДИСП.Г',
+ VARPA: 'ДИСПРА',
+ 'VAR.S': 'ДИСП.В',
VLOOKUP: 'ВПР',
WEEKDAY: 'ДЕНЬНЕД',
WEEKNUM: 'НОМНЕДЕЛИ',
@@ -212,7 +223,6 @@ const dictionary: RawTranslationPackage = {
XOR: 'ИСКЛИЛИ',
YEAR: 'ГОД',
YEARFRAC: 'ДОЛЯГОДА',
- REPLACE: 'ЗАМЕНИТЬ',
'HF.ADD': 'HF.ADD',
'HF.CONCAT': 'HF.CONCAT',
'HF.DIVIDE': 'HF.DIVIDE',
@@ -228,6 +238,10 @@ const dictionary: RawTranslationPackage = {
'HF.UMINUS': 'HF.UMINUS',
'HF.UNARY_PERCENT': 'HF.UNARY_PERCENT',
'HF.UPLUS': 'HF.UPLUS',
+ VAR: 'ДИСП',
+ VARP: 'ДИСПР',
+ STDEV: 'СТАНДОТКЛОН',
+ STDEVP: 'СТАНДОТКЛОНП',
},
langCode: 'ruRU',
ui: {
diff --git a/src/i18n/languages/svSE.ts b/src/i18n/languages/svSE.ts
index 8b606c277d..4509fc548f 100644
--- a/src/i18n/languages/svSE.ts
+++ b/src/i18n/languages/svSE.ts
@@ -153,7 +153,7 @@ const dictionary: RawTranslationPackage = {
OR: 'ELLER',
PI: 'PI',
PMT: 'BETALNING',
- SUBSTITUTE: 'BYT.UT',
+ PRODUCT: 'PRODUKT',
POWER: 'UPPHÖJT.TILL',
PPMT: 'AMORT',
PROPER: 'INITIAL',
@@ -161,6 +161,7 @@ const dictionary: RawTranslationPackage = {
RADIANS: 'RADIANER',
RAND: 'SLUMP',
RATE: 'RÄNTA',
+ REPLACE: 'ERSÄTT',
REPT: 'REP',
RIGHT: 'HÖGER',
ROUND: 'AVRUNDA',
@@ -180,6 +181,12 @@ const dictionary: RawTranslationPackage = {
SLN: 'LINAVSKR',
SPLIT: 'SPLIT',
SQRT: 'ROT',
+ STDEVA: 'STDEVA',
+ 'STDEV.P': 'STDAV.P',
+ STDEVPA: 'STDEVPA',
+ 'STDEV.S': 'STDAV.S',
+ SUBSTITUTE: 'BYT.UT',
+ SUBTOTAL: 'DELSUMMA',
SUM: 'SUMMA',
SUMIF: 'SUMMA.OM',
SUMIFS: 'SUMMA.OMF',
@@ -204,6 +211,10 @@ const dictionary: RawTranslationPackage = {
UNICHAR: 'UNICHAR',
UNICODE: 'UNICODE',
UPPER: 'VERSALER',
+ VARA: 'VARA',
+ 'VAR.P': 'VARIANS.P',
+ VARPA: 'VARPA',
+ 'VAR.S': 'VARIANS.S',
VLOOKUP: 'LETARAD',
WEEKDAY: 'VECKODAG',
WEEKNUM: 'VECKONR',
@@ -212,7 +223,6 @@ const dictionary: RawTranslationPackage = {
XOR: 'XOR',
YEAR: 'ÅR',
YEARFRAC: 'ÅRDEL',
- REPLACE: 'ERSÄTT',
'HF.ADD': 'HF.ADD',
'HF.CONCAT': 'HF.CONCAT',
'HF.DIVIDE': 'HF.DIVIDE',
@@ -228,6 +238,10 @@ const dictionary: RawTranslationPackage = {
'HF.UMINUS': 'HF.UMINUS',
'HF.UNARY_PERCENT': 'HF.UNARY_PERCENT',
'HF.UPLUS': 'HF.UPLUS',
+ VAR: 'VARIANS',
+ VARP: 'VARIANSP',
+ STDEV: 'STDAV',
+ STDEVP: 'STDAVP',
},
langCode: 'svSE',
ui: {
diff --git a/src/i18n/languages/trTR.ts b/src/i18n/languages/trTR.ts
index 4408cca0f1..984acb100a 100644
--- a/src/i18n/languages/trTR.ts
+++ b/src/i18n/languages/trTR.ts
@@ -153,7 +153,7 @@ const dictionary: RawTranslationPackage = {
OR: 'VEYA',
PI: 'Pİ',
PMT: 'DEVRESEL_ÖDEME',
- SUBSTITUTE: 'YERİNEKOY',
+ PRODUCT: 'ÇARPIM',
POWER: 'KUVVET',
PPMT: 'ANA_PARA_ÖDEMESİ',
PROPER: 'YAZIM.DÜZENİ',
@@ -161,6 +161,7 @@ const dictionary: RawTranslationPackage = {
RADIANS: 'RADYAN',
RAND: 'S_SAYI_ÜRET',
RATE: 'FAİZ_ORANI',
+ REPLACE: 'DEĞİŞTİR',
REPT: 'YİNELE',
RIGHT: 'SAĞ',
ROUND: 'YUVARLA',
@@ -180,6 +181,12 @@ const dictionary: RawTranslationPackage = {
SLN: 'DA',
SPLIT: 'SPLIT',
SQRT: 'KAREKÖK',
+ STDEVA: 'STDSAPMAA',
+ 'STDEV.P': 'STDSAPMA.P',
+ STDEVPA: 'STDSAPMASA',
+ 'STDEV.S': 'STDSAPMA.S',
+ SUBSTITUTE: 'YERİNEKOY',
+ SUBTOTAL: 'ALTTOPLAM SUMY.CZĘŚCIOWE',
SUM: 'TOPLA',
SUMIF: 'ETOPLA',
SUMIFS: 'ÇOKETOPLA',
@@ -204,6 +211,10 @@ const dictionary: RawTranslationPackage = {
UNICHAR: 'UNICODEKARAKTERİ',
UNICODE: 'UNICODE',
UPPER: 'BÜYÜKHARF',
+ VARA: 'VARA',
+ 'VAR.P': 'VAR.P',
+ VARPA: 'VARSA',
+ 'VAR.S': 'VAR.S',
VLOOKUP: 'DÜŞEYARA',
WEEKDAY: 'HAFTANINGÜNÜ',
WEEKNUM: 'HAFTASAY',
@@ -212,7 +223,6 @@ const dictionary: RawTranslationPackage = {
XOR: 'ÖZELVEYA',
YEAR: 'YIL',
YEARFRAC: 'YILORAN',
- REPLACE: 'DEĞİŞTİR',
'HF.ADD': 'HF.ADD',
'HF.CONCAT': 'HF.CONCAT',
'HF.DIVIDE': 'HF.DIVIDE',
@@ -228,6 +238,10 @@ const dictionary: RawTranslationPackage = {
'HF.UMINUS': 'HF.UMINUS',
'HF.UNARY_PERCENT': 'HF.UNARY_PERCENT',
'HF.UPLUS': 'HF.UPLUS',
+ VAR: 'VAR',
+ VARP: 'VARS',
+ STDEV: 'STDSAPMA',
+ STDEVP: 'STDSAPMAS',
},
langCode: 'trTR',
ui: {
diff --git a/src/interpreter/plugin/NumericAggregationPlugin.ts b/src/interpreter/plugin/NumericAggregationPlugin.ts
index 20e6e36abf..3a2abd0068 100644
--- a/src/interpreter/plugin/NumericAggregationPlugin.ts
+++ b/src/interpreter/plugin/NumericAggregationPlugin.ts
@@ -8,11 +8,11 @@ import {AbsoluteCellRange, DIFFERENT_SHEETS_ERROR} from '../../AbsoluteCellRange
import {CellError, EmptyValue, ErrorType, InternalScalarValue, SimpleCellAddress} from '../../Cell'
import {ErrorMessage} from '../../error-message'
import {Maybe} from '../../Maybe'
-import {AstNodeType, CellRangeAst, ProcedureAst} from '../../parser'
+import {Ast, AstNodeType, CellRangeAst, ProcedureAst} from '../../parser'
+import {ColumnRangeAst, RowRangeAst} from '../../parser/Ast'
import {coerceBooleanToNumber} from '../ArithmeticHelper'
import {SimpleRangeValue} from '../InterpreterValue'
-import {FunctionPlugin} from './FunctionPlugin'
-import {ColumnRangeAst, RowRangeAst} from '../../parser/Ast'
+import {ArgumentTypes, FunctionPlugin} from './FunctionPlugin'
export type BinaryOperation = (left: T, right: T) => T
@@ -32,22 +32,23 @@ function zeroForInfinite(value: InternalScalarValue) {
}
}
-class AverageResult {
+class MomentsAggregate {
- public static empty = new AverageResult(0, 0)
+ public static empty = new MomentsAggregate(0, 0, 0)
- public static single(arg: number): AverageResult {
- return new AverageResult(arg, 1)
+ public static single(arg: number): MomentsAggregate {
+ return new MomentsAggregate(arg*arg, arg, 1)
}
constructor(
+ public readonly sumsq: number,
public readonly sum: number,
public readonly count: number,
) {
}
- public compose(other: AverageResult) {
- return new AverageResult(this.sum + other.sum, this.count + other.count)
+ public compose(other: MomentsAggregate) {
+ return new MomentsAggregate(this.sumsq + other.sumsq, this.sum + other.sum, this.count + other.count)
}
public averageValue(): Maybe {
@@ -57,6 +58,22 @@ class AverageResult {
return undefined
}
}
+
+ public varSValue(): Maybe {
+ if(this.count > 1) {
+ return (this.sumsq - (this.sum*this.sum)/this.count)/(this.count-1)
+ } else {
+ return undefined
+ }
+ }
+
+ public varPValue(): Maybe {
+ if(this.count > 0) {
+ return (this.sumsq - (this.sum*this.sum)/this.count)/this.count
+ } else {
+ return undefined
+ }
+ }
}
export class NumericAggregationPlugin extends FunctionPlugin {
@@ -91,6 +108,48 @@ export class NumericAggregationPlugin extends FunctionPlugin {
'AVERAGEA': {
method: 'averagea',
},
+ 'PRODUCT': {
+ method: 'product',
+ },
+ 'VAR.S': {
+ method: 'vars',
+ },
+ 'VAR': {
+ method: 'vars', //alias of VAR.S
+ },
+ 'VAR.P': {
+ method: 'varp',
+ },
+ 'VARP': {
+ method: 'varp', //alias of VAR.P
+ },
+ 'VARA': {
+ method: 'vara',
+ },
+ 'VARPA': {
+ method: 'varpa',
+ },
+ 'STDEV.S': {
+ method: 'stdevs',
+ },
+ 'STDEV': {
+ method: 'stdevs', //alias of STDEV.S
+ },
+ 'STDEV.P': {
+ method: 'stdevp',
+ },
+ 'STDEVP': {
+ method: 'stdevp', //alias of STDEVP
+ },
+ 'STDEVA': {
+ method: 'stdeva',
+ },
+ 'STDEVPA': {
+ method: 'stdevpa',
+ },
+ 'SUBTOTAL': {
+ method: 'subtotal',
+ }
}
/**
@@ -102,20 +161,13 @@ export class NumericAggregationPlugin extends FunctionPlugin {
* @param formulaAddress
*/
public sum(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue {
- if (ast.args.length < 1) {
- return new CellError(ErrorType.NA, ErrorMessage.WrongArgNumber)
- }
- return this.reduce(ast, formulaAddress, 0, 'SUM', this.addWithEpsilon, identityMap, strictlyNumbers)
+ return this.doSum(ast.args, formulaAddress)
}
public sumsq(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue {
- if (ast.args.length < 1) {
- return new CellError(ErrorType.NA, ErrorMessage.WrongArgNumber)
- }
- return this.reduce(ast, formulaAddress, 0, 'SUMSQ', this.addWithEpsilon, (arg) => arg * arg, strictlyNumbers)
+ return this.reduce(ast.args, formulaAddress, 0, 'SUMSQ', this.addWithEpsilon, (arg) => arg * arg, strictlyNumbers)
}
-
/**
* Corresponds to MAX(Number1, Number2, ...).
*
@@ -125,21 +177,11 @@ export class NumericAggregationPlugin extends FunctionPlugin {
* @param formulaAddress
*/
public max(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue {
- if (ast.args.length < 1) {
- return new CellError(ErrorType.NA, ErrorMessage.WrongArgNumber)
- }
- const value = this.reduce(ast, formulaAddress, Number.NEGATIVE_INFINITY, 'MAX',
- (left, right) => Math.max(left, right),
- identityMap, strictlyNumbers)
-
- return zeroForInfinite(value)
+ return this.doMax(ast.args, formulaAddress)
}
public maxa(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue {
- if (ast.args.length < 1) {
- return new CellError(ErrorType.NA, ErrorMessage.WrongArgNumber)
- }
- const value = this.reduce(ast, formulaAddress, Number.NEGATIVE_INFINITY, 'MAXA',
+ const value = this.reduce(ast.args, formulaAddress, Number.NEGATIVE_INFINITY, 'MAXA',
(left, right) => Math.max(left, right),
identityMap, numbersBooleans)
@@ -155,21 +197,11 @@ export class NumericAggregationPlugin extends FunctionPlugin {
* @param formulaAddress
*/
public min(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue {
- if (ast.args.length < 1) {
- return new CellError(ErrorType.NA, ErrorMessage.WrongArgNumber)
- }
- const value = this.reduce(ast, formulaAddress, Number.POSITIVE_INFINITY, 'MIN',
- (left, right) => Math.min(left, right),
- identityMap, strictlyNumbers)
-
- return zeroForInfinite(value)
+ return this.doMin(ast.args, formulaAddress)
}
public mina(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue {
- if (ast.args.length < 1) {
- return new CellError(ErrorType.NA, ErrorMessage.WrongArgNumber)
- }
- const value = this.reduce(ast, formulaAddress, Number.POSITIVE_INFINITY, 'MINA',
+ const value = this.reduce(ast.args, formulaAddress, Number.POSITIVE_INFINITY, 'MINA',
(left, right) => Math.min(left, right),
identityMap, numbersBooleans)
@@ -177,40 +209,160 @@ export class NumericAggregationPlugin extends FunctionPlugin {
}
public count(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue {
- if (ast.args.length < 1) {
- return new CellError(ErrorType.NA, ErrorMessage.WrongArgNumber)
- }
- const value = this.reduce(ast, formulaAddress, 0, 'COUNT',
- (left, right) => left + right, identityMap,
- (arg) => (typeof arg === 'number') ? 1 : 0
+ return this.doCount(ast.args, formulaAddress)
+ }
+
+ public counta(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue {
+ return this.doCounta(ast.args, formulaAddress)
+ }
+
+ public average(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue {
+ return this.doAverage(ast.args, formulaAddress)
+ }
+
+ public averagea(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue {
+ const result = this.reduce(ast.args, formulaAddress, MomentsAggregate.empty, '_AGGREGATE_A',
+ (left, right) => left.compose(right),
+ (arg): MomentsAggregate => MomentsAggregate.single(arg),
+ numbersBooleans
)
- return value
+ if (result instanceof CellError) {
+ return result
+ } else {
+ return result.averageValue() ?? new CellError(ErrorType.DIV_BY_ZERO)
+ }
}
- public counta(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue {
- if (ast.args.length < 1) {
- return new CellError(ErrorType.NA, ErrorMessage.WrongArgNumber)
+ public vars(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue {
+ return this.doVarS(ast.args, formulaAddress)
+ }
+
+ public varp(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue {
+ return this.doVarP(ast.args, formulaAddress)
+ }
+
+ public vara(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue {
+ const result = this.reduceAggregateA(ast.args, formulaAddress)
+
+ if (result instanceof CellError) {
+ return result
+ } else {
+ return result.varSValue() ?? new CellError(ErrorType.DIV_BY_ZERO)
}
- const value = this.reduce(ast, formulaAddress, 0, 'COUNTA', (left, right) => left + right,
- identityMap,
- (arg) => (arg === EmptyValue) ? 0 : 1
- )
+ }
- return value
+ public varpa(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue {
+ const result = this.reduceAggregateA(ast.args, formulaAddress)
+
+ if (result instanceof CellError) {
+ return result
+ } else {
+ return result.varPValue() ?? new CellError(ErrorType.DIV_BY_ZERO)
+ }
}
- public average(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue {
+ public stdevs(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue {
+ return this.doStdevS(ast.args, formulaAddress)
+ }
+
+ public stdevp(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue {
+ return this.doStdevP(ast.args, formulaAddress)
+ }
+
+ public stdeva(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue {
+ const result = this.reduceAggregateA(ast.args, formulaAddress)
+
+ if (result instanceof CellError) {
+ return result
+ } else {
+ const val = result.varSValue()
+ return val === undefined ? new CellError(ErrorType.DIV_BY_ZERO) : Math.sqrt(val)
+ }
+ }
+
+ public stdevpa(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue {
+ const result = this.reduceAggregateA(ast.args, formulaAddress)
+
+ if (result instanceof CellError) {
+ return result
+ } else {
+ const val = result.varPValue()
+ return val === undefined ? new CellError(ErrorType.DIV_BY_ZERO) : Math.sqrt(val)
+ }
+ }
+
+ public product(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue {
+ return this.doProduct(ast.args, formulaAddress)
+ }
+
+ public subtotal(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue {
if (ast.args.length < 1) {
return new CellError(ErrorType.NA, ErrorMessage.WrongArgNumber)
}
- const result = this.reduce(ast, formulaAddress, AverageResult.empty, 'AVERAGE', (left, right) => {
+ const functionType = this.coerceToType(this.evaluateAst(ast.args[0], formulaAddress), {argumentType: ArgumentTypes.NUMBER})
+ const args = ast.args.slice(1)
+ switch (functionType) {
+ case 1:
+ case 101:
+ return this.doAverage(args, formulaAddress)
+ case 2:
+ case 102:
+ return this.doCount(args, formulaAddress)
+ case 3:
+ case 103:
+ return this.doCounta(args, formulaAddress)
+ case 4:
+ case 104:
+ return this.doMax(args, formulaAddress)
+ case 5:
+ case 105:
+ return this.doMin(args, formulaAddress)
+ case 6:
+ case 106:
+ return this.doProduct(args, formulaAddress)
+ case 7:
+ case 107:
+ return this.doStdevS(args, formulaAddress)
+ case 8:
+ case 108:
+ return this.doStdevP(args, formulaAddress)
+ case 9:
+ case 109:
+ return this.doSum(args, formulaAddress)
+ case 10:
+ case 110:
+ return this.doVarS(args, formulaAddress)
+ case 11:
+ case 111:
+ return this.doVarP(args, formulaAddress)
+ default:
+ return new CellError(ErrorType.VALUE, ErrorMessage.BadMode)
+ }
+ }
+
+ private reduceAggregate(args: Ast[], formulaAddress: SimpleCellAddress): MomentsAggregate | CellError{
+ return this.reduce(args, formulaAddress, MomentsAggregate.empty, '_AGGREGATE', (left, right) => {
return left.compose(right)
- }, (arg): AverageResult => {
- return AverageResult.single(arg)
+ }, (arg): MomentsAggregate => {
+ return MomentsAggregate.single(arg)
},
strictlyNumbers
)
+ }
+
+ private reduceAggregateA(args: Ast[], formulaAddress: SimpleCellAddress): MomentsAggregate | CellError{
+ return this.reduce(args, formulaAddress, MomentsAggregate.empty, '_AGGREGATE_A', (left, right) => {
+ return left.compose(right)
+ }, (arg): MomentsAggregate => {
+ return MomentsAggregate.single(arg)
+ },
+ numbersBooleans
+ )
+ }
+
+ private doAverage(args: Ast[], formulaAddress: SimpleCellAddress): InternalScalarValue {
+ const result = this.reduceAggregate(args, formulaAddress)
if (result instanceof CellError) {
return result
@@ -219,23 +371,92 @@ export class NumericAggregationPlugin extends FunctionPlugin {
}
}
- public averagea(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue {
- if (ast.args.length < 1) {
- return new CellError(ErrorType.NA, ErrorMessage.WrongArgNumber)
+ private doVarS(args: Ast[], formulaAddress: SimpleCellAddress): InternalScalarValue {
+ const result = this.reduceAggregate(args, formulaAddress)
+
+ if (result instanceof CellError) {
+ return result
+ } else {
+ return result.varSValue() ?? new CellError(ErrorType.DIV_BY_ZERO)
}
- const result = this.reduce(ast, formulaAddress, AverageResult.empty, 'AVERAGE',
- (left, right) => left.compose(right),
- (arg): AverageResult => AverageResult.single(arg),
- numbersBooleans
- )
+ }
+
+ private doVarP(args: Ast[], formulaAddress: SimpleCellAddress): InternalScalarValue {
+ const result = this.reduceAggregate(args, formulaAddress)
if (result instanceof CellError) {
return result
} else {
- return result.averageValue() ?? new CellError(ErrorType.DIV_BY_ZERO)
+ return result.varPValue() ?? new CellError(ErrorType.DIV_BY_ZERO)
}
}
+ private doStdevS(args: Ast[], formulaAddress: SimpleCellAddress): InternalScalarValue {
+ const result = this.reduceAggregate(args, formulaAddress)
+
+ if (result instanceof CellError) {
+ return result
+ } else {
+ const val = result.varSValue()
+ return val === undefined ? new CellError(ErrorType.DIV_BY_ZERO) : Math.sqrt(val)
+ }
+ }
+
+ private doStdevP(args: Ast[], formulaAddress: SimpleCellAddress): InternalScalarValue {
+ const result = this.reduceAggregate(args, formulaAddress)
+
+ if (result instanceof CellError) {
+ return result
+ } else {
+ const val = result.varPValue()
+ return val === undefined ? new CellError(ErrorType.DIV_BY_ZERO) : Math.sqrt(val)
+ }
+ }
+
+ private doCount(args: Ast[], formulaAddress: SimpleCellAddress): InternalScalarValue {
+ const value = this.reduce(args, formulaAddress, 0, 'COUNT',
+ (left, right) => left + right, identityMap,
+ (arg) => (typeof arg === 'number') ? 1 : 0
+ )
+
+ return value
+ }
+
+ private doCounta(args: Ast[], formulaAddress: SimpleCellAddress): InternalScalarValue {
+ const value = this.reduce(args, formulaAddress, 0, 'COUNTA', (left, right) => left + right,
+ identityMap,
+ (arg) => (arg === EmptyValue) ? 0 : 1
+ )
+
+ return value
+ }
+
+ private doMax(args: Ast[], formulaAddress: SimpleCellAddress): InternalScalarValue {
+ const value = this.reduce(args, formulaAddress, Number.NEGATIVE_INFINITY, 'MAX',
+ (left, right) => Math.max(left, right),
+ identityMap, strictlyNumbers
+ )
+
+ return zeroForInfinite(value)
+ }
+
+ private doMin(args: Ast[], formulaAddress: SimpleCellAddress): InternalScalarValue {
+ const value = this.reduce(args, formulaAddress, Number.POSITIVE_INFINITY, 'MIN',
+ (left, right) => Math.min(left, right),
+ identityMap, strictlyNumbers
+ )
+
+ return zeroForInfinite(value)
+ }
+
+ private doSum(args: Ast[], formulaAddress: SimpleCellAddress): InternalScalarValue {
+ return this.reduce(args, formulaAddress, 0, 'SUM', this.addWithEpsilon, identityMap, strictlyNumbers)
+ }
+
+ private doProduct(args: Ast[], formulaAddress: SimpleCellAddress): InternalScalarValue {
+ return this.reduce(args, formulaAddress, 1, 'PRODUCT', (left, right) => left * right, identityMap, strictlyNumbers)
+ }
+
private addWithEpsilon = (left: number, right: number): number => this.interpreter.arithmeticHelper.addWithEpsilon(left, right)
/**
@@ -249,8 +470,11 @@ export class NumericAggregationPlugin extends FunctionPlugin {
* @param mapFunction
* @param coerceFunction
* */
- private reduce(ast: ProcedureAst, formulaAddress: SimpleCellAddress, initialAccValue: T, functionName: string, reducingFunction: BinaryOperation, mapFunction: MapOperation, coercionFunction: coercionOperation): CellError | T {
- return ast.args.reduce((acc: T | CellError, arg) => {
+ private reduce(args: Ast[], formulaAddress: SimpleCellAddress, initialAccValue: T, functionName: string, reducingFunction: BinaryOperation, mapFunction: MapOperation, coercionFunction: coercionOperation): CellError | T {
+ if (args.length < 1) {
+ return new CellError(ErrorType.NA, ErrorMessage.WrongArgNumber)
+ }
+ return args.reduce((acc: T | CellError, arg) => {
if (acc instanceof CellError) {
return acc
}
diff --git a/test/interpreter/function-product.spec.ts b/test/interpreter/function-product.spec.ts
new file mode 100644
index 0000000000..f405dc4ad1
--- /dev/null
+++ b/test/interpreter/function-product.spec.ts
@@ -0,0 +1,24 @@
+import {ErrorType, HyperFormula} from '../../src'
+import {ErrorMessage} from '../../src/error-message'
+import {adr, detailedError} from '../testUtils'
+
+describe('Function PRODUCT', () => {
+ it('should take at least one argument', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=PRODUCT()']
+ ])
+
+ expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber))
+ })
+
+ it('should calculate product', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=PRODUCT(2, 3)'],
+ ['=PRODUCT(B2:D2, E2, F2)', 2, 3, 'foo', 'bar', 4],
+ ['=PRODUCT(5, "foo")']
+ ])
+ expect(engine.getCellValue(adr('A1'))).toEqual(6)
+ expect(engine.getCellValue(adr('A2'))).toEqual(24)
+ expect(engine.getCellValue(adr('A3'))).toEqualError(detailedError(ErrorType.VALUE, ErrorMessage.NumberCoercion))
+ })
+})
diff --git a/test/interpreter/function-stdev.p.spec.ts b/test/interpreter/function-stdev.p.spec.ts
new file mode 100644
index 0000000000..84e5e78665
--- /dev/null
+++ b/test/interpreter/function-stdev.p.spec.ts
@@ -0,0 +1,43 @@
+import {ErrorType, HyperFormula} from '../../src'
+import {adr, detailedError} from '../testUtils'
+import {ErrorMessage} from '../../src/error-message'
+
+describe('Function STDEV.P', () => {
+ it('should take at least one argument', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=STDEV.P()'],
+ ])
+
+ expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber))
+ })
+
+ it('should calculate standard deviation (population)', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=STDEV.P(2, 3)'],
+ ['=STDEV.P(1)'],
+ ])
+ expect(engine.getCellValue(adr('A1'))).toEqual(0.5)
+ expect(engine.getCellValue(adr('A2'))).toEqual(0)
+ })
+
+ it('should coerce explicit argument to numbers', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=STDEV.P(2, 3, 4, TRUE(), FALSE(), "1",)'],
+ ])
+ expect(engine.getCellValue(adr('A1'))).toBeCloseTo(1.39970842444753, 6) //inconsistency with product #1
+ })
+
+ it('should ignore non-numeric values in ranges, including ignoring logical values and text representation of numbers', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=STDEV.P(B1:I1)', 2, 3, 4, true, false, 'a', '\'1', null],
+ ])
+ expect(engine.getCellValue(adr('A1'))).toBeCloseTo(0.816496580927726, 6)
+ })
+
+ it('should propagate errors', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=STDEV.P(B1:I1)', 2, 3, 4, '=NA()', false, 'a', '\'1', null],
+ ])
+ expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA))
+ })
+})
diff --git a/test/interpreter/function-stdev.s.spec.ts b/test/interpreter/function-stdev.s.spec.ts
new file mode 100644
index 0000000000..6d9fd20137
--- /dev/null
+++ b/test/interpreter/function-stdev.s.spec.ts
@@ -0,0 +1,44 @@
+import {ErrorType, HyperFormula} from '../../src'
+import {adr, detailedError} from '../testUtils'
+import {ErrorMessage} from '../../src/error-message'
+
+describe('Function STDEV.S', () => {
+ it('should take at least two arguments', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=STDEV.S()'],
+ ['=STDEV.S(1)']
+ ])
+
+ expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber))
+ expect(engine.getCellValue(adr('A2'))).toEqualError(detailedError(ErrorType.DIV_BY_ZERO))
+ })
+
+ it('should calculate standard deviation (sample)', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=STDEV.S(2, 3)'],
+ ])
+ expect(engine.getCellValue(adr('A1'))).toBeCloseTo(0.707106781186548, 6)
+ })
+
+
+ it('should coerce explicit argument to numbers', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=STDEV.S(2, 3, 4, TRUE(), FALSE(), "1",)'],
+ ])
+ expect(engine.getCellValue(adr('A1'))).toBeCloseTo(1.51185789203691, 6) //inconsistency with product #1
+ })
+
+ it('should ignore non-numeric values in ranges, including ignoring logical values and text representation of numbers', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=STDEV.S(B1:I1)', 2, 3, 4, true, false, 'a', '\'1', null],
+ ])
+ expect(engine.getCellValue(adr('A1'))).toEqual(1)
+ })
+
+ it('should propagate errors', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=STDEV.S(B1:I1)', 2, 3, 4, '=NA()', false, 'a', '\'1', null],
+ ])
+ expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA))
+ })
+})
diff --git a/test/interpreter/function-stdev.spec.ts b/test/interpreter/function-stdev.spec.ts
new file mode 100644
index 0000000000..eec40a9681
--- /dev/null
+++ b/test/interpreter/function-stdev.spec.ts
@@ -0,0 +1,10 @@
+import {HyperFormula} from '../../src'
+
+describe('Function STDEV', () => {
+ it('should be an alias of STDEV.S', () => {
+ const engine = HyperFormula.buildEmpty()
+ const metadata1 = engine.getFunctionPlugin('STDEV')?.implementedFunctions!['STDEV']
+ const metadata2 = engine.getFunctionPlugin('STDEV.S')?.implementedFunctions!['STDEV.S']
+ expect(metadata1).toEqual(metadata2)
+ })
+})
diff --git a/test/interpreter/function-stdeva.spec.ts b/test/interpreter/function-stdeva.spec.ts
new file mode 100644
index 0000000000..fc4c518bb3
--- /dev/null
+++ b/test/interpreter/function-stdeva.spec.ts
@@ -0,0 +1,43 @@
+import {ErrorType, HyperFormula} from '../../src'
+import {adr, detailedError} from '../testUtils'
+import {ErrorMessage} from '../../src/error-message'
+
+describe('Function STDEVA', () => {
+ it('should take at least two arguments', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=STDEVA()'],
+ ['=STDEVA(1)']
+ ])
+
+ expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber))
+ expect(engine.getCellValue(adr('A2'))).toEqualError(detailedError(ErrorType.DIV_BY_ZERO))
+ })
+
+ it('should calculate standard deviation (sample)', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=STDEVA(2, 3)'],
+ ])
+ expect(engine.getCellValue(adr('A1'))).toEqual(0.707106781186548)
+ })
+
+ it('should coerce explicit argument to numbers', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=STDEVA(2, 3, 4, TRUE(), FALSE(), "1",)'],
+ ])
+ expect(engine.getCellValue(adr('A1'))).toBeCloseTo(1.51185789203691)
+ })
+
+ it('should evaluate TRUE to 1, FALSE to 0 and text to 0', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=STDEVA(B1:I1)', 2, 3, 4, true, false, 'a', '\'1', null],
+ ])
+ expect(engine.getCellValue(adr('A1'))).toBeCloseTo(1.61834718742537)
+ })
+
+ it('should propagate errors', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=STDEVA(B1:I1)', 2, 3, 4, '=NA()', false, 'a', '\'1', null],
+ ])
+ expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA))
+ })
+})
diff --git a/test/interpreter/function-stdevp.spec.ts b/test/interpreter/function-stdevp.spec.ts
new file mode 100644
index 0000000000..0ddeb524f7
--- /dev/null
+++ b/test/interpreter/function-stdevp.spec.ts
@@ -0,0 +1,10 @@
+import {HyperFormula} from '../../src'
+
+describe('Function STDEVP', () => {
+ it('should be an alias of STDEV.P', () => {
+ const engine = HyperFormula.buildEmpty()
+ const metadata1 = engine.getFunctionPlugin('STDEVP')?.implementedFunctions!['STDEVP']
+ const metadata2 = engine.getFunctionPlugin('STDEV.P')?.implementedFunctions!['STDEV.P']
+ expect(metadata1).toEqual(metadata2)
+ })
+})
diff --git a/test/interpreter/function-stdevpa.spec.ts b/test/interpreter/function-stdevpa.spec.ts
new file mode 100644
index 0000000000..f08cc1fb16
--- /dev/null
+++ b/test/interpreter/function-stdevpa.spec.ts
@@ -0,0 +1,43 @@
+import {ErrorType, HyperFormula} from '../../src'
+import {adr, detailedError} from '../testUtils'
+import {ErrorMessage} from '../../src/error-message'
+
+describe('Function STDEVPA', () => {
+ it('should take at least one argument', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=STDEVPA()'],
+ ])
+
+ expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber))
+ })
+
+ it('should calculate standard deviation (population)', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=STDEVPA(2, 3)'],
+ ['=STDEVPA(1)'],
+ ])
+ expect(engine.getCellValue(adr('A1'))).toEqual(0.5)
+ expect(engine.getCellValue(adr('A2'))).toEqual(0)
+ })
+
+ it('should coerce explicit argument to numbers', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=STDEVPA(2, 3, 4, TRUE(), FALSE(), "1",)'],
+ ])
+ expect(engine.getCellValue(adr('A1'))).toBeCloseTo(1.39970842444753, 6)
+ })
+
+ it('should evaluate TRUE to 1, FALSE to 0 and text to 0', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=STDEVPA(B1:I1)', 2, 3, 4, true, false, 'a', '\'1', null],
+ ])
+ expect(engine.getCellValue(adr('A1'))).toBeCloseTo(1.49829835452879, 6)
+ })
+
+ it('should propagate errors', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=STDEVPA(B1:I1)', 2, 3, 4, '=NA()', false, 'a', '\'1', null],
+ ])
+ expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA))
+ })
+})
diff --git a/test/interpreter/function-subtotal.spec.ts b/test/interpreter/function-subtotal.spec.ts
new file mode 100644
index 0000000000..609e99f5b8
--- /dev/null
+++ b/test/interpreter/function-subtotal.spec.ts
@@ -0,0 +1,174 @@
+import {ErrorType, HyperFormula} from '../../src'
+import {ErrorMessage} from '../../src/error-message'
+import {adr, detailedError} from '../testUtils'
+
+describe('Function SUBTOTAL', () => {
+ it('should calculate AVERAGE', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=SUBTOTAL(1, A2:A4, A5)', '=SUBTOTAL(101, A2:A4, A5)'],
+ [2],
+ [3],
+ [4],
+ [5]
+ ])
+
+ expect(engine.getCellValue(adr('A1'))).toEqual(3.5)
+ expect(engine.getCellValue(adr('B1'))).toEqual(3.5)
+ })
+
+ it('should calculate COUNT', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=SUBTOTAL(2, A2:A4, A5)', '=SUBTOTAL(102, A2:A4, A5)'],
+ [2],
+ ['foo'],
+ [4],
+ [5]
+ ])
+
+ expect(engine.getCellValue(adr('A1'))).toEqual(3)
+ expect(engine.getCellValue(adr('B1'))).toEqual(3)
+ })
+
+
+ it('should calculate COUNTA', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=SUBTOTAL(3, A2:A4, A5)', '=SUBTOTAL(103, A2:A4, A5)'],
+ [2],
+ ['foo'],
+ [4],
+ [5]
+ ])
+
+ expect(engine.getCellValue(adr('A1'))).toEqual(4)
+ expect(engine.getCellValue(adr('B1'))).toEqual(4)
+ })
+
+ it('should calcuate MAX', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=SUBTOTAL(4, A2:A4, A5)', '=SUBTOTAL(104, A2:A4, A5)'],
+ [3],
+ [5],
+ [2],
+ [4]
+ ])
+
+ expect(engine.getCellValue(adr('A1'))).toEqual(5)
+ expect(engine.getCellValue(adr('B1'))).toEqual(5)
+ })
+
+ it('should calculate MIN', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=SUBTOTAL(5, A2:A4, A5)', '=SUBTOTAL(105, A2:A4, A5)'],
+ [3],
+ [5],
+ [2],
+ [4]
+ ])
+
+ expect(engine.getCellValue(adr('A1'))).toEqual(2)
+ expect(engine.getCellValue(adr('B1'))).toEqual(2)
+ })
+
+ it('should calculate PRODUCT', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=SUBTOTAL(6, A2:A4, A5)', '=SUBTOTAL(106, A2:A4, A5)'],
+ [3],
+ [5],
+ [2],
+ [4]
+ ])
+
+ expect(engine.getCellValue(adr('A1'))).toEqual(120)
+ expect(engine.getCellValue(adr('B1'))).toEqual(120)
+ })
+
+ it('should calculate STDEV.S', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=SUBTOTAL(7, A2:A4, A5)', '=SUBTOTAL(107, A2:A4, A5)'],
+ [3],
+ [5],
+ [2],
+ [4]
+ ])
+
+ expect(engine.getCellValue(adr('A1'))).toBeCloseTo(1.29099444873581, 6)
+ expect(engine.getCellValue(adr('B1'))).toBeCloseTo(1.29099444873581, 6)
+ })
+
+ it('should calculate STDEV.P', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=SUBTOTAL(8, A2:A4, A5)', '=SUBTOTAL(108, A2:A4, A5)'],
+ [3],
+ [5],
+ [2],
+ [4]
+ ])
+
+ expect(engine.getCellValue(adr('A1'))).toBeCloseTo(1.11803398875, 6)
+ expect(engine.getCellValue(adr('B1'))).toBeCloseTo(1.11803398875, 6)
+ })
+
+ it('should calculate SUM', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=SUBTOTAL(9, A2:A4, A5)', '=SUBTOTAL(109, A2:A4, A5)'],
+ [3],
+ [5],
+ [2],
+ [4]
+ ])
+
+ expect(engine.getCellValue(adr('A1'))).toEqual(14)
+ expect(engine.getCellValue(adr('B1'))).toEqual(14)
+ })
+
+ it('should calculate VAR.S', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=SUBTOTAL(10, A2:A4, A5)', '=SUBTOTAL(110, A2:A4, A5)'],
+ [3],
+ [5],
+ [2],
+ [4]
+ ])
+
+ expect(engine.getCellValue(adr('A1'))).toBeCloseTo(5/3, 6)
+ expect(engine.getCellValue(adr('B1'))).toBeCloseTo(5/3, 6)
+ })
+
+ it('should calculate VAR.P', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=SUBTOTAL(11, A2:A4, A5)', '=SUBTOTAL(111, A2:A4, A5)'],
+ [3],
+ [5],
+ [2],
+ [4]
+ ])
+
+ expect(engine.getCellValue(adr('A1'))).toEqual(5/4)
+ expect(engine.getCellValue(adr('B1'))).toEqual(5/4)
+ })
+
+ it('should return correct error', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=SUBTOTAL(12345, A2:A4, A5)'],
+ [3],
+ [5],
+ [2],
+ [4]
+ ])
+
+ expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.VALUE, ErrorMessage.BadMode))
+ })
+
+ /**
+ * Inconsistency with ODFF standard.
+ */
+ it('does not ignore other SUBTOTALS', () => {
+ const engine = HyperFormula.buildFromArray( [
+ ['=SUBTOTAL(9, A2:A4)'],
+ ['=SUBTOTAL(9, B2:C2)', 1, 1],
+ ['=SUBTOTAL(9, B3:C3)', 1, 1],
+ ['=SUBTOTAL(9, B4:C4)', 1, 1],
+ ])
+ expect(engine.getCellValue(adr('A1'))).toEqual(6)
+ })
+})
diff --git a/test/interpreter/function-var.p.spec.ts b/test/interpreter/function-var.p.spec.ts
new file mode 100644
index 0000000000..5d14c22f22
--- /dev/null
+++ b/test/interpreter/function-var.p.spec.ts
@@ -0,0 +1,43 @@
+import {ErrorType, HyperFormula} from '../../src'
+import {adr, detailedError} from '../testUtils'
+import {ErrorMessage} from '../../src/error-message'
+
+describe('Function VAR.P', () => {
+ it('should take at least one argument', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=VAR.P()'],
+ ])
+
+ expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber))
+ })
+
+ it('should calculate variance (population)', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=VAR.P(2, 3)'],
+ ['=VAR.P(1)'],
+ ])
+ expect(engine.getCellValue(adr('A1'))).toEqual(0.25)
+ expect(engine.getCellValue(adr('A2'))).toEqual(0)
+ })
+
+ it('should coerce explicit argument to numbers', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=VAR.P(2, 3, 4, TRUE(), FALSE(), "1",)'],
+ ])
+ expect(engine.getCellValue(adr('A1'))).toBeCloseTo(1.95918367346939, 6) //inconsistency with product #1
+ })
+
+ it('should ignore non-numeric values in ranges, including ignoring logical values and text representation of numbers', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=VAR.P(B1:I1)', 2, 3, 4, true, false, 'a', '\'1', null],
+ ])
+ expect(engine.getCellValue(adr('A1'))).toBeCloseTo(0.666666666666667, 6)
+ })
+
+ it('should propagate errors', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=VAR.P(B1:I1)', 2, 3, 4, '=NA()', false, 'a', '\'1', null],
+ ])
+ expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA))
+ })
+})
diff --git a/test/interpreter/function-var.s.spec.ts b/test/interpreter/function-var.s.spec.ts
new file mode 100644
index 0000000000..a6ef8db9b6
--- /dev/null
+++ b/test/interpreter/function-var.s.spec.ts
@@ -0,0 +1,44 @@
+import {ErrorType, HyperFormula} from '../../src'
+import {adr, detailedError} from '../testUtils'
+import {ErrorMessage} from '../../src/error-message'
+
+describe('Function VAR.S', () => {
+ it('should take at least two arguments', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=VAR.S()'],
+ ['=VAR.S(1)']
+ ])
+
+ expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber))
+ expect(engine.getCellValue(adr('A2'))).toEqualError(detailedError(ErrorType.DIV_BY_ZERO))
+ })
+
+ it('should calculate variance (sample)', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=VAR.S(2, 3)'],
+ ])
+ expect(engine.getCellValue(adr('A1'))).toEqual(0.5)
+ })
+
+
+ it('should coerce explicit argument to numbers', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=VAR.S(2, 3, 4, TRUE(), FALSE(), "1",)'],
+ ])
+ expect(engine.getCellValue(adr('A1'))).toBeCloseTo(2.28571428571429, 6) //inconsistency with product #1
+ })
+
+ it('should ignore non-numeric values in ranges, including ignoring logical values and text representation of numbers', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=VAR.S(B1:I1)', 2, 3, 4, true, false, 'a', '\'1', null],
+ ])
+ expect(engine.getCellValue(adr('A1'))).toEqual(1)
+ })
+
+ it('should propagate errors', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=VAR.S(B1:I1)', 2, 3, 4, '=NA()', false, 'a', '\'1', null],
+ ])
+ expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA))
+ })
+})
diff --git a/test/interpreter/function-var.spec.ts b/test/interpreter/function-var.spec.ts
new file mode 100644
index 0000000000..4b67c166a0
--- /dev/null
+++ b/test/interpreter/function-var.spec.ts
@@ -0,0 +1,10 @@
+import {HyperFormula} from '../../src'
+
+describe('Function VAR', () => {
+ it('should be an alias of VAR.S', () => {
+ const engine = HyperFormula.buildEmpty()
+ const metadata1 = engine.getFunctionPlugin('VAR')?.implementedFunctions!['VAR']
+ const metadata2 = engine.getFunctionPlugin('VAR.S')?.implementedFunctions!['VAR.S']
+ expect(metadata1).toEqual(metadata2)
+ })
+})
diff --git a/test/interpreter/function-vara.spec.ts b/test/interpreter/function-vara.spec.ts
new file mode 100644
index 0000000000..5d655ae09c
--- /dev/null
+++ b/test/interpreter/function-vara.spec.ts
@@ -0,0 +1,43 @@
+import {ErrorType, HyperFormula} from '../../src'
+import {adr, detailedError} from '../testUtils'
+import {ErrorMessage} from '../../src/error-message'
+
+describe('Function VARA', () => {
+ it('should take at least two arguments', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=VARA()'],
+ ['=VARA(1)']
+ ])
+
+ expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber))
+ expect(engine.getCellValue(adr('A2'))).toEqualError(detailedError(ErrorType.DIV_BY_ZERO))
+ })
+
+ it('should calculate variance (sample)', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=VARA(2, 3)'],
+ ])
+ expect(engine.getCellValue(adr('A1'))).toBeCloseTo(0.5, 6)
+ })
+
+ it('should coerce explicit argument to numbers', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=VARA(2, 3, 4, TRUE(), FALSE(), "1",)'],
+ ])
+ expect(engine.getCellValue(adr('A1'))).toBeCloseTo(2.28571428571429)
+ })
+
+ it('should evaluate TRUE to 1, FALSE to 0 and text to 0', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=VARA(B1:I1)', 2, 3, 4, true, false, 'a', '\'1', null],
+ ])
+ expect(engine.getCellValue(adr('A1'))).toBeCloseTo(2.61904761904762)
+ })
+
+ it('should propagate errors', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=VARA(B1:I1)', 2, 3, 4, '=NA()', false, 'a', '\'1', null],
+ ])
+ expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA))
+ })
+})
diff --git a/test/interpreter/function-varp.spec.ts b/test/interpreter/function-varp.spec.ts
new file mode 100644
index 0000000000..7ada3977e6
--- /dev/null
+++ b/test/interpreter/function-varp.spec.ts
@@ -0,0 +1,10 @@
+import {HyperFormula} from '../../src'
+
+describe('Function VARP', () => {
+ it('should be an alias of VAR.P', () => {
+ const engine = HyperFormula.buildEmpty()
+ const metadata1 = engine.getFunctionPlugin('VARP')?.implementedFunctions!['VARP']
+ const metadata2 = engine.getFunctionPlugin('VAR.P')?.implementedFunctions!['VAR.P']
+ expect(metadata1).toEqual(metadata2)
+ })
+})
diff --git a/test/interpreter/function-varpa.spec.ts b/test/interpreter/function-varpa.spec.ts
new file mode 100644
index 0000000000..0b37691ad9
--- /dev/null
+++ b/test/interpreter/function-varpa.spec.ts
@@ -0,0 +1,43 @@
+import {ErrorType, HyperFormula} from '../../src'
+import {adr, detailedError} from '../testUtils'
+import {ErrorMessage} from '../../src/error-message'
+
+describe('Function VARPA', () => {
+ it('should take at least one argument', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=VARPA()'],
+ ])
+
+ expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber))
+ })
+
+ it('should calculate variance (population)', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=VARPA(2, 3)'],
+ ['=VARPA(1)'],
+ ])
+ expect(engine.getCellValue(adr('A1'))).toEqual(0.25)
+ expect(engine.getCellValue(adr('A2'))).toEqual(0)
+ })
+
+ it('should coerce explicit argument to numbers', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=VARPA(2, 3, 4, TRUE(), FALSE(), "1",)'],
+ ])
+ expect(engine.getCellValue(adr('A1'))).toBeCloseTo(1.95918367346939, 6)
+ })
+
+ it('should evaluate TRUE to 1, FALSE to 0 and text to 0', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=VARPA(B1:I1)', 2, 3, 4, true, false, 'a', '\'1', null],
+ ])
+ expect(engine.getCellValue(adr('A1'))).toBeCloseTo(2.24489795918367, 6)
+ })
+
+ it('should propagate errors', () => {
+ const engine = HyperFormula.buildFromArray([
+ ['=VARPA(B1:I1)', 2, 3, 4, '=NA()', false, 'a', '\'1', null],
+ ])
+ expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA))
+ })
+})