Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

fix(formula): fix numbervalue/datevalue/timevalue calculate (#5637)

wpxp12345660c59f9661af
diff --git a/packages/engine-formula/src/engine/utils/numfmt-kit.ts b/packages/engine-formula/src/engine/utils/numfmt-kit.ts
index 9648aab69c..fd2b19cc7a 100644
--- a/packages/engine-formula/src/engine/utils/numfmt-kit.ts
+++ b/packages/engine-formula/src/engine/utils/numfmt-kit.ts
@@ -296,6 +296,11 @@ const countryCurrencySymbolMap = new Map<LocaleType, string>([
[LocaleType.VI_VN, '₫'],
[LocaleType.ZH_CN, '¥'],
[LocaleType.ZH_TW, 'NT$'],
+ [LocaleType.FR_FR, '€'],
+ [LocaleType.FA_IR, '﷼'],
+ [LocaleType.KO_KR, '₩'],
+ [LocaleType.ES_ES, '€'],
+ [LocaleType.CA_ES, '€'],
]);
function getCurrencySymbol(locale: LocaleType): string {
diff --git a/packages/engine-formula/src/engine/value-object/array-value-object.ts b/packages/engine-formula/src/engine/value-object/array-value-object.ts
index 5ab7a77bef..0c59693438 100644
--- a/packages/engine-formula/src/engine/value-object/array-value-object.ts
+++ b/packages/engine-formula/src/engine/value-object/array-value-object.ts
@@ -55,7 +55,7 @@ export function fromObjectToString(array: IArrayValueObject) {
return '';
}
-export function transformToValueObject(array: Array<Array<number | string | boolean | null>> = []) {
+export function transformToValueObject(array: Array<Array<number | string | boolean | null>> = [], isIgnoreNumberPattern: boolean = false) {
const arrayValueList: BaseValueObject[][] = [];
for (let r = 0; r < array.length; r++) {
@@ -68,7 +68,7 @@ export function transformToValueObject(array: Array<Array<number | string | bool
for (let c = 0; c < row.length; c++) {
const cell = row[c];
- arrayValueList[r][c] = ValueObjectFactory.create(cell);
+ arrayValueList[r][c] = ValueObjectFactory.create(cell, isIgnoreNumberPattern);
}
}
diff --git a/packages/engine-formula/src/functions/date/datevalue/__tests__/index.spec.ts b/packages/engine-formula/src/functions/date/datevalue/__tests__/index.spec.ts
index ab2d90a4ff..1a38aa6952 100644
--- a/packages/engine-formula/src/functions/date/datevalue/__tests__/index.spec.ts
+++ b/packages/engine-formula/src/functions/date/datevalue/__tests__/index.spec.ts
@@ -16,9 +16,10 @@
import { describe, expect, it } from 'vitest';
import { ErrorType } from '../../../../basics/error-type';
-import { ArrayValueObject, transformToValue, transformToValueObject } from '../../../../engine/value-object/array-value-object';
+import { ArrayValueObject, transformToValueObject } from '../../../../engine/value-object/array-value-object';
import { ErrorValueObject } from '../../../../engine/value-object/base-value-object';
import { BooleanValueObject, NullValueObject, NumberValueObject, StringValueObject } from '../../../../engine/value-object/primitive-object';
+import { getObjectValue } from '../../../util';
import { FUNCTION_NAMES_DATE } from '../../function-names';
import { Datevalue } from '../index';
@@ -29,46 +30,49 @@ describe('Test datevalue function', () => {
it('Date text string', () => {
const dateText = StringValueObject.create('2020-01-02');
const result = testFunction.calculate(dateText);
- expect(result.getValue()).toStrictEqual(43832);
+ expect(getObjectValue(result)).toStrictEqual(43832);
const dateText2 = StringValueObject.create('5-Jul');
const result2 = testFunction.calculate(dateText2);
- expect(result2.getValue()).toStrictEqual(45843); // NOTE: this should be updated annually
+ expect(getObjectValue(result2)).toStrictEqual(45843); // NOTE: this should be updated annually
const dateText3 = StringValueObject.create('2020-01-02 13:14:15');
const result3 = testFunction.calculate(dateText3);
- expect(result3.getValue()).toStrictEqual(43832);
+ expect(getObjectValue(result3)).toStrictEqual(43832);
const dateText4 = StringValueObject.create('10:11:12');
const result4 = testFunction.calculate(dateText4);
- expect(result4.getValue()).toStrictEqual(0);
+ expect(getObjectValue(result4)).toStrictEqual(0);
});
it('Date text number', () => {
const dateText = NumberValueObject.create(43832);
const result = testFunction.calculate(dateText);
- expect(result.getValue()).toStrictEqual(ErrorType.VALUE);
+ expect(getObjectValue(result)).toStrictEqual(ErrorType.VALUE);
});
it('Date text boolean', () => {
const dateText = BooleanValueObject.create(true);
const result = testFunction.calculate(dateText);
- expect(result.getValue()).toStrictEqual(ErrorType.VALUE);
+ expect(getObjectValue(result)).toStrictEqual(ErrorType.VALUE);
});
it('Date text blank', () => {
const dateText = NullValueObject.create();
const result = testFunction.calculate(dateText);
- expect(result.getValue()).toStrictEqual(ErrorType.VALUE);
+ expect(getObjectValue(result)).toStrictEqual(ErrorType.VALUE);
});
it('Date text error', () => {
const dateText = ErrorValueObject.create(ErrorType.NAME);
const result = testFunction.calculate(dateText);
- expect(result.getValue()).toStrictEqual(ErrorType.NAME);
+ expect(getObjectValue(result)).toStrictEqual(ErrorType.NAME);
});
it('Serial number is array', () => {
const serialNumber = ArrayValueObject.create({
- calculateValueList: transformToValueObject([[1, ' ', 1.23, true, false, null], [0, '100', '2.34', 'test', -3, ErrorType.NAME]]),
+ calculateValueList: transformToValueObject([
+ [1, ' ', 1.23, true, false, null],
+ [0, '2024-8-8 12:47:55', '2024-8-8', 'test', -3, ErrorType.NAME],
+ ], true),
rowCount: 2,
columnCount: 6,
unitId: '',
@@ -77,21 +81,10 @@ describe('Test datevalue function', () => {
column: 0,
});
const result = testFunction.calculate(serialNumber);
- expect(transformToValue(result.getArrayValue())).toStrictEqual([[
- ErrorType.VALUE,
- ErrorType.VALUE,
- ErrorType.VALUE,
- ErrorType.VALUE,
- ErrorType.VALUE,
- ErrorType.VALUE,
- ], [
- ErrorType.VALUE,
- ErrorType.VALUE,
- ErrorType.VALUE,
- ErrorType.VALUE,
- ErrorType.VALUE,
- ErrorType.NAME,
- ]]);
+ expect(getObjectValue(result)).toStrictEqual([
+ [ErrorType.VALUE, ErrorType.VALUE, ErrorType.VALUE, ErrorType.VALUE, ErrorType.VALUE, ErrorType.VALUE],
+ [ErrorType.VALUE, 45512, 45512, ErrorType.VALUE, ErrorType.VALUE, ErrorType.NAME],
+ ]);
});
});
});
diff --git a/packages/engine-formula/src/functions/date/datevalue/index.ts b/packages/engine-formula/src/functions/date/datevalue/index.ts
index ec1a728a92..5004764176 100644
--- a/packages/engine-formula/src/functions/date/datevalue/index.ts
+++ b/packages/engine-formula/src/functions/date/datevalue/index.ts
@@ -26,19 +26,23 @@ export class Datevalue extends BaseFunction {
override maxParams = 1;
- override calculate(dateText: BaseValueObject) {
- if (dateText.isError()) {
- return dateText;
- }
+ override isArgumentsIgnoreNumberPattern(): boolean {
+ return true;
+ }
+ override calculate(dateText: BaseValueObject) {
if (dateText.isArray()) {
- return dateText.map((dateTextObject) => this._handleSingleObject(dateTextObject));
+ return dateText.mapValue((dateTextObject) => this._handleSingleObject(dateTextObject));
}
return this._handleSingleObject(dateText);
}
private _handleSingleObject(dateTextObject: BaseValueObject) {
+ if (dateTextObject.isError()) {
+ return dateTextObject;
+ }
+
if (dateTextObject.isString()) {
const value = `${dateTextObject.getValue()}`;
let parsedDate = parseFormattedDate(value);
diff --git a/packages/engine-formula/src/functions/date/timevalue/__tests__/index.spec.ts b/packages/engine-formula/src/functions/date/timevalue/__tests__/index.spec.ts
index 28c804787f..4fbedfa631 100644
--- a/packages/engine-formula/src/functions/date/timevalue/__tests__/index.spec.ts
+++ b/packages/engine-formula/src/functions/date/timevalue/__tests__/index.spec.ts
@@ -16,9 +16,10 @@
import { describe, expect, it } from 'vitest';
import { ErrorType } from '../../../../basics/error-type';
-import { ArrayValueObject, transformToValue, transformToValueObject } from '../../../../engine/value-object/array-value-object';
+import { ArrayValueObject, transformToValueObject } from '../../../../engine/value-object/array-value-object';
import { ErrorValueObject } from '../../../../engine/value-object/base-value-object';
import { BooleanValueObject, NullValueObject, NumberValueObject, StringValueObject } from '../../../../engine/value-object/primitive-object';
+import { getObjectValue } from '../../../util';
import { FUNCTION_NAMES_DATE } from '../../function-names';
import { Timevalue } from '../index';
@@ -29,42 +30,45 @@ describe('Test timevalue function', () => {
it('Time text string', () => {
const timetText = StringValueObject.create('2020-01-02');
const result = testFunction.calculate(timetText);
- expect(result.getValue()).toStrictEqual(0);
+ expect(getObjectValue(result)).toStrictEqual(0);
const timetText2 = StringValueObject.create('2020-01-02 13:14:15');
const result2 = testFunction.calculate(timetText2);
- expect(result2.getValue()).toStrictEqual(0.5515624999970896);
+ expect(getObjectValue(result2, true)).toStrictEqual(0.551562499997);
const timetText3 = StringValueObject.create('10:11:12');
const result3 = testFunction.calculate(timetText3);
- expect(result3.getValue()).toStrictEqual(0.42444444444444446);
+ expect(getObjectValue(result3, true)).toStrictEqual(0.424444444444);
});
it('Time text number', () => {
const timetText = NumberValueObject.create(43832);
const result = testFunction.calculate(timetText);
- expect(result.getValue()).toStrictEqual(ErrorType.VALUE);
+ expect(getObjectValue(result)).toStrictEqual(ErrorType.VALUE);
});
it('Time text boolean', () => {
const timetText = BooleanValueObject.create(true);
const result = testFunction.calculate(timetText);
- expect(result.getValue()).toStrictEqual(ErrorType.VALUE);
+ expect(getObjectValue(result)).toStrictEqual(ErrorType.VALUE);
});
it('Time text blank', () => {
const timetText = NullValueObject.create();
const result = testFunction.calculate(timetText);
- expect(result.getValue()).toStrictEqual(ErrorType.VALUE);
+ expect(getObjectValue(result)).toStrictEqual(ErrorType.VALUE);
});
it('Time text error', () => {
const timetText = ErrorValueObject.create(ErrorType.NAME);
const result = testFunction.calculate(timetText);
- expect(result.getValue()).toStrictEqual(ErrorType.NAME);
+ expect(getObjectValue(result)).toStrictEqual(ErrorType.NAME);
});
it('Serial number is array', () => {
const serialNumber = ArrayValueObject.create({
- calculateValueList: transformToValueObject([[1, ' ', 1.23, true, false, null], [0, '100', '2.34', 'test', -3, ErrorType.NAME]]),
+ calculateValueList: transformToValueObject([
+ [1, ' ', 1.23, true, false, null],
+ [0, '2024-8-8 12:47:55', '2024-8-8', 'test', -3, ErrorType.NAME],
+ ], true),
rowCount: 2,
columnCount: 6,
unitId: '',
@@ -73,7 +77,10 @@ describe('Test timevalue function', () => {
column: 0,
});
const result = testFunction.calculate(serialNumber);
- expect(transformToValue(result.getArrayValue())).toStrictEqual([[ErrorType.VALUE, ErrorType.VALUE, ErrorType.VALUE, ErrorType.VALUE, ErrorType.VALUE, ErrorType.VALUE], [ErrorType.VALUE, ErrorType.VALUE, ErrorType.VALUE, ErrorType.VALUE, ErrorType.VALUE, ErrorType.NAME]]);
+ expect(getObjectValue(result, true)).toStrictEqual([
+ [ErrorType.VALUE, ErrorType.VALUE, ErrorType.VALUE, ErrorType.VALUE, ErrorType.VALUE, ErrorType.VALUE],
+ [ErrorType.VALUE, 0.533275462964, 0, ErrorType.VALUE, ErrorType.VALUE, ErrorType.NAME],
+ ]);
});
});
});
diff --git a/packages/engine-formula/src/functions/date/timevalue/index.ts b/packages/engine-formula/src/functions/date/timevalue/index.ts
index a3fca50666..e6587af834 100644
--- a/packages/engine-formula/src/functions/date/timevalue/index.ts
+++ b/packages/engine-formula/src/functions/date/timevalue/index.ts
@@ -27,19 +27,23 @@ export class Timevalue extends BaseFunction {
override maxParams = 1;
- override calculate(timeText: BaseValueObject) {
- if (timeText.isError()) {
- return timeText;
- }
+ override isArgumentsIgnoreNumberPattern(): boolean {
+ return true;
+ }
+ override calculate(timeText: BaseValueObject) {
if (timeText.isArray()) {
- return timeText.map((timeTextObject) => this._handleSingleObject(timeTextObject));
+ return timeText.mapValue((timeTextObject) => this._handleSingleObject(timeTextObject));
}
return this._handleSingleObject(timeText);
}
private _handleSingleObject(timeTextObject: BaseValueObject) {
+ if (timeTextObject.isError()) {
+ return timeTextObject;
+ }
+
if (timeTextObject.isString()) {
const value = `${timeTextObject.getValue()}`;
const parsedTime = parseFormattedValue(value);
diff --git a/packages/engine-formula/src/functions/text/numbervalue/__test__/index.spec.ts b/packages/engine-formula/src/functions/text/numbervalue/__test__/index.spec.ts
index 88a5013149..b146eddd61 100644
--- a/packages/engine-formula/src/functions/text/numbervalue/__test__/index.spec.ts
+++ b/packages/engine-formula/src/functions/text/numbervalue/__test__/index.spec.ts
@@ -101,8 +101,8 @@ describe('Test numbervalue function', () => {
const number = ArrayValueObject.create({
calculateValueList: transformToValueObject([
[1, ' ', 1.23, true, false, null],
- [0, '100', '2.34', 'test', -3, ErrorType.NAME],
- ]),
+ [0, '2,500.27', '20%', 'test', -3, ErrorType.NAME],
+ ], true),
rowCount: 2,
columnCount: 6,
unitId: '',
@@ -113,7 +113,7 @@ describe('Test numbervalue function', () => {
const result = testFunction.calculate(number);
expect(getObjectValue(result)).toStrictEqual([
[1, 0, 1.23, ErrorType.VALUE, ErrorType.VALUE, 0],
- [0, 100, 2.34, ErrorType.VALUE, -3, ErrorType.NAME],
+ [0, 2500.27, 0.2, ErrorType.VALUE, -3, ErrorType.NAME],
]);
});
diff --git a/packages/engine-formula/src/functions/text/numbervalue/index.ts b/packages/engine-formula/src/functions/text/numbervalue/index.ts
index d13187f662..7544c40e93 100644
--- a/packages/engine-formula/src/functions/text/numbervalue/index.ts
+++ b/packages/engine-formula/src/functions/text/numbervalue/index.ts
@@ -28,6 +28,10 @@ export class Numbervalue extends BaseFunction {
override maxParams = 3;
+ override isArgumentsIgnoreNumberPattern(): boolean {
+ return true;
+ }
+
override calculate(text: BaseValueObject, decimalSeparator?: BaseValueObject, groupSeparator?: BaseValueObject): BaseValueObject {
const _decimalSeparator = decimalSeparator ?? StringValueObject.create('.');
diff --git a/packages/sheets-formula/src/services/function-list/financial.ts b/packages/sheets-formula/src/services/function-list/financial.ts
index f12d9901bf..54c2c35226 100644
--- a/packages/sheets-formula/src/services/function-list/financial.ts
+++ b/packages/sheets-formula/src/services/function-list/financial.ts
@@ -27,28 +27,28 @@ export const FUNCTION_LIST_FINANCIAL: IFunctionInfo[] = [
{
name: 'formula.functionList.ACCRINT.functionParameter.issue.name',
detail: 'formula.functionList.ACCRINT.functionParameter.issue.detail',
- example: '39508',
+ example: '"2008-3-1"',
require: 1,
repeat: 0,
},
{
name: 'formula.functionList.ACCRINT.functionParameter.firstInterest.name',
detail: 'formula.functionList.ACCRINT.functionParameter.firstInterest.detail',
- example: '39691',
+ example: '"2008-8-31"',
require: 1,
repeat: 0,
},
{
name: 'formula.functionList.ACCRINT.functionParameter.settlement.name',
detail: 'formula.functionList.ACCRINT.functionParameter.settlement.detail',
- example: '39569',
+ example: '"2008-5-1"',
require: 1,
repeat: 0,
},
{
name: 'formula.functionList.ACCRINT.functionParameter.rate.name',
detail: 'formula.functionList.ACCRINT.functionParameter.rate.detail',
- example: '0.1',
+ example: '10%',
require: 1,
repeat: 0,
},
@@ -105,7 +105,7 @@ export const FUNCTION_LIST_FINANCIAL: IFunctionInfo[] = [
{
name: 'formula.functionList.ACCRINTM.functionParameter.rate.name',
detail: 'formula.functionList.ACCRINTM.functionParameter.rate.detail',
- example: '0.1',
+ example: '10%',
require: 1,
repeat: 0,
},
@@ -163,14 +163,14 @@ export const FUNCTION_LIST_FINANCIAL: IFunctionInfo[] = [
{
name: 'formula.functionList.AMORLINC.functionParameter.datePurchased.name',
detail: 'formula.functionList.AMORLINC.functionParameter.datePurchased.detail',
- example: '39679',
+ example: '"2008-8-19"',
require: 1,
repeat: 0,
},
{
name: 'formula.functionList.AMORLINC.functionParameter.firstPeriod.name',
detail: 'formula.functionList.AMORLINC.functionParameter.firstPeriod.detail',
- example: '39813',
+ example: '"2008-12-31"',
require: 1,
repeat: 0,
},
@@ -191,7 +191,7 @@ export const FUNCTION_LIST_FINANCIAL: IFunctionInfo[] = [
{
name: 'formula.functionList.AMORLINC.functionParameter.rate.name',
detail: 'formula.functionList.AMORLINC.functionParameter.rate.detail',
- example: '0.15',
+ example: '15%',
require: 1,
repeat: 0,
},
@@ -429,7 +429,7 @@ export const FUNCTION_LIST_FINANCIAL: IFunctionInfo[] = [
{
name: 'formula.functionList.CUMIPMT.functionParameter.rate.name',
detail: 'formula.functionList.CUMIPMT.functionParameter.rate.detail',
- example: '0.09/12',
+ example: '9%/12',
require: 1,
repeat: 0,
},
@@ -479,7 +479,7 @@ export const FUNCTION_LIST_FINANCIAL: IFunctionInfo[] = [
{
name: 'formula.functionList.CUMPRINC.functionParameter.rate.name',
detail: 'formula.functionList.CUMPRINC.functionParameter.rate.detail',
- example: '0.09/12',
+ example: '9%/12',
require: 1,
repeat: 0,
},
@@ -716,14 +716,14 @@ export const FUNCTION_LIST_FINANCIAL: IFunctionInfo[] = [
{
name: 'formula.functionList.DURATION.functionParameter.coupon.name',
detail: 'formula.functionList.DURATION.functionParameter.coupon.detail',
- example: '0.08',
+ example: '8%',
require: 1,
repeat: 0,
},
{
name: 'formula.functionList.DURATION.functionParameter.yld.name',
detail: 'formula.functionList.DURATION.functionParameter.yld.detail',
- example: '0.09',
+ example: '9%',
require: 1,
repeat: 0,
},
@@ -752,7 +752,7 @@ export const FUNCTION_LIST_FINANCIAL: IFunctionInfo[] = [
{
name: 'formula.functionList.EFFECT.functionParameter.nominalRate.name',
detail: 'formula.functionList.EFFECT.functionParameter.nominalRate.detail',
- example: '0.0525',
+ example: '5.25%',
require: 1,
repeat: 0,
},
@@ -774,7 +774,7 @@ export const FUNCTION_LIST_FINANCIAL: IFunctionInfo[] = [
{
name: 'formula.functionList.FV.functionParameter.rate.name',
detail: 'formula.functionList.FV.functionParameter.rate.detail',
- example: '0.06/12',
+ example: '6%/12',
require: 1,
repeat: 0,
},
@@ -882,7 +882,7 @@ export const FUNCTION_LIST_FINANCIAL: IFunctionInfo[] = [
{
name: 'formula.functionList.IPMT.functionParameter.rate.name',
detail: 'formula.functionList.IPMT.functionParameter.rate.detail',
- example: '0.1/12',
+ example: '10%/12',
require: 1,
repeat: 0,
},
@@ -954,7 +954,7 @@ export const FUNCTION_LIST_FINANCIAL: IFunctionInfo[] = [
{
name: 'formula.functionList.ISPMT.functionParameter.rate.name',
detail: 'formula.functionList.ISPMT.functionParameter.rate.detail',
- example: '0.1',
+ example: '10%',
require: 1,
repeat: 0,
},
@@ -1004,14 +1004,14 @@ export const FUNCTION_LIST_FINANCIAL: IFunctionInfo[] = [
{
name: 'formula.functionList.MDURATION.functionParameter.coupon.name',
detail: 'formula.functionList.MDURATION.functionParameter.coupon.detail',
- example: '0.08',
+ example: '8%',
require: 1,
repeat: 0,
},
{
name: 'formula.functionList.MDURATION.functionParameter.yld.name',
detail: 'formula.functionList.MDURATION.functionParameter.yld.detail',
- example: '0.09',
+ example: '9%',
require: 1,
repeat: 0,
},
@@ -1047,14 +1047,14 @@ export const FUNCTION_LIST_FINANCIAL: IFunctionInfo[] = [
{
name: 'formula.functionList.MIRR.functionParameter.financeRate.name',
detail: 'formula.functionList.MIRR.functionParameter.financeRate.detail',
- example: '0.1',
+ example: '10%',
require: 1,
repeat: 0,
},
{
name: 'formula.functionList.MIRR.functionParameter.reinvestRate.name',
detail: 'formula.functionList.MIRR.functionParameter.reinvestRate.detail',
- example: '0.12',
+ example: '12%',
require: 1,
repeat: 0,
},
@@ -1069,7 +1069,7 @@ export const FUNCTION_LIST_FINANCIAL: IFunctionInfo[] = [
{
name: 'formula.functionList.NOMINAL.functionParameter.effectRate.name',
detail: 'formula.functionList.NOMINAL.functionParameter.effectRate.detail',
- example: '0.053543',
+ example: '5.3543%',
require: 1,
repeat: 0,
},
@@ -1091,7 +1091,7 @@ export const FUNCTION_LIST_FINANCIAL: IFunctionInfo[] = [
{
name: 'formula.functionList.NPER.functionParameter.rate.name',
detail: 'formula.functionList.NPER.functionParameter.rate.detail',
- example: '0.12/12',
+ example: '12%/12',
require: 1,
repeat: 0,
},
@@ -1134,7 +1134,7 @@ export const FUNCTION_LIST_FINANCIAL: IFunctionInfo[] = [
{
name: 'formula.functionList.NPV.functionParameter.rate.name',
detail: 'formula.functionList.NPV.functionParameter.rate.detail',
- example: '0.1',
+ example: '10%',
require: 1,
repeat: 0,
},
@@ -1191,14 +1191,14 @@ export const FUNCTION_LIST_FINANCIAL: IFunctionInfo[] = [
{
name: 'formula.functionList.ODDFPRICE.functionParameter.rate.name',
detail: 'formula.functionList.ODDFPRICE.functionParameter.rate.detail',
- example: '0.0785',
+ example: '7.85%',
require: 1,
repeat: 0,
},
{
name: 'formula.functionList.ODDFPRICE.functionParameter.yld.name',
detail: 'formula.functionList.ODDFPRICE.functionParameter.yld.detail',
- example: '0.0625',
+ example: '6.25%',
require: 1,
repeat: 0,
},
@@ -1262,7 +1262,7 @@ export const FUNCTION_LIST_FINANCIAL: IFunctionInfo[] = [
{
name: 'formula.functionList.ODDFYIELD.functionParameter.rate.name',
detail: 'formula.functionList.ODDFYIELD.functionParameter.rate.detail',
- example: '0.0575',
+ example: '5.75%',
require: 1,
repeat: 0,
},
@@ -1305,35 +1305,35 @@ export const FUNCTION_LIST_FINANCIAL: IFunctionInfo[] = [
{
name: 'formula.functionList.ODDLPRICE.functionParameter.settlement.name',
detail: 'formula.functionList.ODDLPRICE.functionParameter.settlement.detail',
- example: '"2008-11-11"',
+ example: '"2008-2-7"',
require: 1,
repeat: 0,
},
{
name: 'formula.functionList.ODDLPRICE.functionParameter.maturity.name',
detail: 'formula.functionList.ODDLPRICE.functionParameter.maturity.detail',
- example: '"2021-3-1"',
+ example: '"2008-6-15"',
require: 1,
repeat: 0,
},
{
name: 'formula.functionList.ODDLPRICE.functionParameter.lastInterest.name',
detail: 'formula.functionList.ODDLPRICE.functionParameter.lastInterest.detail',
- example: '"2009-3-1"',
+ example: '"2007-10-15"',
require: 1,
repeat: 0,
},
{
name: 'formula.functionList.ODDLPRICE.functionParameter.rate.name',
detail: 'formula.functionList.ODDLPRICE.functionParameter.rate.detail',
- example: '0.0785',
+ example: '3.75%',
require: 1,
repeat: 0,
},
{
name: 'formula.functionList.ODDLPRICE.functionParameter.yld.name',
detail: 'formula.functionList.ODDLPRICE.functionParameter.yld.detail',
- example: '0.0625',
+ example: '4.05%',
require: 1,
repeat: 0,
},
@@ -1354,7 +1354,7 @@ export const FUNCTION_LIST_FINANCIAL: IFunctionInfo[] = [
{
name: 'formula.functionList.ODDLPRICE.functionParameter.basis.name',
detail: 'formula.functionList.ODDLPRICE.functionParameter.basis.detail',
- example: '1',
+ example: '0',
require: 0,
repeat: 0,
},
@@ -1369,35 +1369,35 @@ export const FUNCTION_LIST_FINANCIAL: IFunctionInfo[] = [
{
name: 'formula.functionList.ODDLYIELD.functionParameter.settlement.name',
detail: 'formula.functionList.ODDLYIELD.functionParameter.settlement.detail',
- example: '"2008-11-11"',
+ example: '"2008-4-20"',
require: 1,
repeat: 0,
},
{
name: 'formula.functionList.ODDLYIELD.functionParameter.maturity.name',
detail: 'formula.functionList.ODDLYIELD.functionParameter.maturity.detail',
- example: '"2021-3-1"',
+ example: '"2008-6-15"',
require: 1,
repeat: 0,
},
{
name: 'formula.functionList.ODDLYIELD.functionParameter.lastInterest.name',
detail: 'formula.functionList.ODDLYIELD.functionParameter.lastInterest.detail',
- example: '"2008-10-15"',
+ example: '"2007-12-24"',
require: 1,
repeat: 0,
},
{
name: 'formula.functionList.ODDLYIELD.functionParameter.rate.name',
detail: 'formula.functionList.ODDLYIELD.functionParameter.rate.detail',
- example: '0.0575',
+ example: '3.75%',
require: 1,
repeat: 0,
},
{
name: 'formula.functionList.ODDLYIELD.functionParameter.pr.name',
detail: 'formula.functionList.ODDLYIELD.functionParameter.pr.detail',
- example: '84.5',
+ example: '99.875',
require: 1,
repeat: 0,
},
@@ -1433,7 +1433,7 @@ export const FUNCTION_LIST_FINANCIAL: IFunctionInfo[] = [
{
name: 'formula.functionList.PDURATION.functionParameter.rate.name',
detail: 'formula.functionList.PDURATION.functionParameter.rate.detail',
- example: '0.025',
+ example: '2.5%',
require: 1,
repeat: 0,
},
@@ -1462,7 +1462,7 @@ export const FUNCTION_LIST_FINANCIAL: IFunctionInfo[] = [
{
name: 'formula.functionList.PMT.functionParameter.rate.name',
detail: 'formula.functionList.PMT.functionParameter.rate.detail',
- example: '0.08/12',
+ example: '8%/12',
require: 1,
repeat: 0,
},
@@ -1505,7 +1505,7 @@ export const FUNCTION_LIST_FINANCIAL: IFunctionInfo[] = [
{
name: 'formula.functionList.PPMT.functionParameter.rate.name',
detail: 'formula.functionList.PPMT.functionParameter.rate.detail',
- example: '0.1/12',
+ example: '10%/12',
require: 1,
repeat: 0,
},
@@ -1569,14 +1569,14 @@ export const FUNCTION_LIST_FINANCIAL: IFunctionInfo[] = [
{
name: 'formula.functionList.PRICE.functionParameter.rate.name',
detail: 'formula.functionList.PRICE.functionParameter.rate.detail',
- example: '0.0785',
+ example: '7.85%',
require: 1,
repeat: 0,
},
{
name: 'formula.functionList.PRICE.functionParameter.yld.name',
detail: 'formula.functionList.PRICE.functionParameter.yld.detail',
- example: '0.0625',
+ example: '6.25%',
require: 1,
repeat: 0,
},
@@ -1626,7 +1626,7 @@ export const FUNCTION_LIST_FINANCIAL: IFunctionInfo[] = [
{
name: 'formula.functionList.PRICEDISC.functionParameter.discount.name',
detail: 'formula.functionList.PRICEDISC.functionParameter.discount.detail',
- example: '0.0625',
+ example: '6.25%',
require: 1,
repeat: 0,
},
@@ -1676,14 +1676,14 @@ export const FUNCTION_LIST_FINANCIAL: IFunctionInfo[] = [
{
name: 'formula.functionList.PRICEMAT.functionParameter.rate.name',
detail: 'formula.functionList.PRICEMAT.functionParameter.rate.detail',
- example: '0.0785',
+ example: '7.85%',
require: 1,
repeat: 0,
},
{
name: 'formula.functionList.PRICEMAT.functionParameter.yld.name',
detail: 'formula.functionList.PRICEMAT.functionParameter.yld.detail',
- example: '0.0625',
+ example: '6.25%',
require: 1,
repeat: 0,
},
@@ -1705,7 +1705,7 @@ export const FUNCTION_LIST_FINANCIAL: IFunctionInfo[] = [
{
name: 'formula.functionList.PV.functionParameter.rate.name',
detail: 'formula.functionList.PV.functionParameter.rate.detail',
- example: '0.02',
+ example: '2%',
require: 1,
repeat: 0,
},
@@ -1819,7 +1819,7 @@ export const FUNCTION_LIST_FINANCIAL: IFunctionInfo[] = [
{
name: 'formula.functionList.RECEIVED.functionParameter.discount.name',
detail: 'formula.functionList.RECEIVED.functionParameter.discount.detail',
- example: '0.0575',
+ example: '5.75%',
require: 1,
repeat: 0,
},
@@ -1949,7 +1949,7 @@ export const FUNCTION_LIST_FINANCIAL: IFunctionInfo[] = [
{
name: 'formula.functionList.TBILLEQ.functionParameter.discount.name',
detail: 'formula.functionList.TBILLEQ.functionParameter.discount.detail',
- example: '0.0914',
+ example: '9.14%',
require: 1,
repeat: 0,
},
@@ -1978,7 +1978,7 @@ export const FUNCTION_LIST_FINANCIAL: IFunctionInfo[] = [
{
name: 'formula.functionList.TBILLPRICE.functionParameter.discount.name',
detail: 'formula.functionList.TBILLPRICE.functionParameter.discount.detail',
- example: '0.0914',
+ example: '9.14%',
require: 1,
repeat: 0,
},
@@ -2108,7 +2108,7 @@ export const FUNCTION_LIST_FINANCIAL: IFunctionInfo[] = [
{
name: 'formula.functionList.XNPV.functionParameter.rate.name',
detail: 'formula.functionList.XNPV.functionParameter.rate.detail',
- example: '0.1',
+ example: '10%',
require: 1,
repeat: 0,
},
@@ -2151,7 +2151,7 @@ export const FUNCTION_LIST_FINANCIAL: IFunctionInfo[] = [
{
name: 'formula.functionList.YIELD.functionParameter.rate.name',
detail: 'formula.functionList.YIELD.functionParameter.rate.detail',
- example: '0.0785',
+ example: '7.85%',
require: 1,
repeat: 0,
},
@@ -2258,7 +2258,7 @@ export const FUNCTION_LIST_FINANCIAL: IFunctionInfo[] = [
{
name: 'formula.functionList.YIELDMAT.functionParameter.rate.name',
detail: 'formula.functionList.YIELDMAT.functionParameter.rate.detail',
- example: '0.0785',
+ example: '7.85%',
require: 1,
repeat: 0,
},
diff --git a/packages/sheets-formula/src/services/function-list/logical.ts b/packages/sheets-formula/src/services/function-list/logical.ts
index 9037a7a632..0fc85eeb4a 100644
--- a/packages/sheets-formula/src/services/function-list/logical.ts
+++ b/packages/sheets-formula/src/services/function-list/logical.ts
@@ -137,7 +137,7 @@ export const FUNCTION_LIST_LOGICAL: IFunctionInfo[] = [
{
name: 'formula.functionList.IFERROR.functionParameter.valueIfError.name',
detail: 'formula.functionList.IFERROR.functionParameter.valueIfError.detail',
- example: 'Error in calculation',
+ example: '"Error in calculation"',
require: 1,
repeat: 0,
},