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.

feat(formula): isformula/n/na (#3304)

wpxp123456ccc427654e96
diff --git a/packages/engine-formula/src/functions/information/function-map.ts b/packages/engine-formula/src/functions/information/function-map.ts
index 8e913ea46c..ff93d238bc 100644
--- a/packages/engine-formula/src/functions/information/function-map.ts
+++ b/packages/engine-formula/src/functions/information/function-map.ts
@@ -21,6 +21,7 @@ import { Isblank } from './isblank';
import { Iserr } from './iserr';
import { Iserror } from './iserror';
import { Iseven } from './iseven/iseven';
+import { Isformula } from './isformula';
import { Islogical } from './islogical';
import { Isna } from './isna';
import { Isnontext } from './isnontext';
@@ -28,6 +29,8 @@ import { Isnumber } from './isnumber';
import { Isodd } from './isodd/isodd';
import { Isref } from './isref';
import { Istext } from './istext';
+import { N } from './n';
+import { Na } from './na';
import { Type } from './type';
export const functionInformation = [
@@ -37,6 +40,7 @@ export const functionInformation = [
[Iserr, FUNCTION_NAMES_INFORMATION.ISERR],
[Iserror, FUNCTION_NAMES_INFORMATION.ISERROR],
[Iseven, FUNCTION_NAMES_INFORMATION.ISEVEN],
+ [Isformula, FUNCTION_NAMES_INFORMATION.ISFORMULA],
[Islogical, FUNCTION_NAMES_INFORMATION.ISLOGICAL],
[Isna, FUNCTION_NAMES_INFORMATION.ISNA],
[Isnontext, FUNCTION_NAMES_INFORMATION.ISNONTEXT],
@@ -44,5 +48,7 @@ export const functionInformation = [
[Isodd, FUNCTION_NAMES_INFORMATION.ISODD],
[Isref, FUNCTION_NAMES_INFORMATION.ISREF],
[Istext, FUNCTION_NAMES_INFORMATION.ISTEXT],
+ [N, FUNCTION_NAMES_INFORMATION.N],
+ [Na, FUNCTION_NAMES_INFORMATION.NA],
[Type, FUNCTION_NAMES_INFORMATION.TYPE],
];
diff --git a/packages/engine-formula/src/functions/information/isformula/__tests__/index.spec.ts b/packages/engine-formula/src/functions/information/isformula/__tests__/index.spec.ts
new file mode 100644
index 0000000000..8d076a13d3
--- /dev/null
+++ b/packages/engine-formula/src/functions/information/isformula/__tests__/index.spec.ts
@@ -0,0 +1,178 @@
+/**
+ * Copyright 2023-present DreamNum Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import type { Injector, IWorkbookData } from '@univerjs/core';
+import { beforeEach, describe, expect, it } from 'vitest';
+
+import { CellValueType, LocaleType } from '@univerjs/core';
+import { Lexer } from '../../../../engine/analysis/lexer';
+import type { LexerNode } from '../../../../engine/analysis/lexer-node';
+import { AstTreeBuilder } from '../../../../engine/analysis/parser';
+import type { BaseAstNode } from '../../../../engine/ast-node/base-ast-node';
+import { Interpreter } from '../../../../engine/interpreter/interpreter';
+import { IFormulaCurrentConfigService } from '../../../../services/current-data.service';
+import { IFunctionService } from '../../../../services/function.service';
+import { IFormulaRuntimeService } from '../../../../services/runtime.service';
+import { createFunctionTestBed } from '../../../__tests__/create-function-test-bed';
+import { FUNCTION_NAMES_INFORMATION } from '../../function-names';
+import type { BaseValueObject, ErrorValueObject } from '../../../../engine/value-object/base-value-object';
+import type { ArrayValueObject } from '../../../../engine/value-object/array-value-object';
+import { Isformula } from '../index';
+import { ErrorType } from '../../../../basics/error-type';
+
+const getTestWorkbookData = (): IWorkbookData => {
+ return {
+ id: 'test',
+ appVersion: '3.0.0-alpha',
+ sheets: {
+ sheet1: {
+ id: 'sheet1',
+ cellData: {
+ 0: {
+ 0: {
+ v: 1,
+ t: CellValueType.NUMBER,
+ },
+ 1: {
+ v: 2,
+ t: CellValueType.NUMBER,
+ },
+ },
+ 1: {
+ 0: {
+ v: 3,
+ t: CellValueType.NUMBER,
+ },
+ 1: {
+ v: 4,
+ t: CellValueType.NUMBER,
+ },
+ 2: {
+ v: 3,
+ t: CellValueType.NUMBER,
+ f: 'SUM(A1:B1)',
+ },
+ 3: {
+ v: '#NAME?',
+ t: CellValueType.STRING,
+ },
+ },
+ },
+ },
+ },
+ locale: LocaleType.ZH_CN,
+ name: '',
+ sheetOrder: [],
+ styles: {},
+ };
+};
+describe('Test isformula function', () => {
+ let get: Injector['get'];
+ let lexer: Lexer;
+ let astTreeBuilder: AstTreeBuilder;
+ let interpreter: Interpreter;
+ let calculate: (formula: string) => (string | number | boolean | null)[][] | string | number | boolean;
+
+ beforeEach(() => {
+ const testBed = createFunctionTestBed(getTestWorkbookData());
+
+ get = testBed.get;
+
+ lexer = get(Lexer);
+ astTreeBuilder = get(AstTreeBuilder);
+ interpreter = get(Interpreter);
+
+ const functionService = get(IFunctionService);
+
+ const formulaCurrentConfigService = get(IFormulaCurrentConfigService);
+
+ const formulaRuntimeService = get(IFormulaRuntimeService);
+
+ formulaCurrentConfigService.load({
+ formulaData: {},
+ arrayFormulaCellData: {},
+ forceCalculate: false,
+ dirtyRanges: [],
+ dirtyNameMap: {},
+ dirtyDefinedNameMap: {},
+ dirtyUnitFeatureMap: {},
+ excludedCell: {},
+ allUnitData: {
+ [testBed.unitId]: testBed.sheetData,
+ },
+ dirtyUnitOtherFormulaMap: {},
+ });
+
+ const sheetItem = testBed.sheetData[testBed.sheetId];
+
+ formulaRuntimeService.setCurrent(
+ 0,
+ 0,
+ sheetItem.rowCount,
+ sheetItem.columnCount,
+ testBed.sheetId,
+ testBed.unitId
+ );
+
+ functionService.registerExecutors(
+ new Isformula(FUNCTION_NAMES_INFORMATION.ISFORMULA)
+ );
+
+ calculate = (formula: string) => {
+ const lexerNode = lexer.treeBuilder(formula);
+
+ const astNode = astTreeBuilder.parse(lexerNode as LexerNode);
+
+ const result = interpreter.execute(astNode as BaseAstNode);
+
+ if ((result as ErrorValueObject).isError()) {
+ return (result as ErrorValueObject).getValue();
+ } else if ((result as ArrayValueObject).isArray()) {
+ return (result as ArrayValueObject).toValue();
+ }
+ return (result as BaseValueObject).getValue();
+ };
+ });
+
+ describe('Isformula', () => {
+ it('value reference single cell', async () => {
+ const result = await calculate('=ISFORMULA(A1)');
+
+ expect(result).toBe(false);
+ });
+
+ it('value reference range', async () => {
+ const result = await calculate('=ISFORMULA(A1:D2)');
+
+ expect(result).toStrictEqual([
+ [false, false, false, false],
+ [false, false, true, false],
+ ]);
+ });
+
+ it('value is error', async () => {
+ const result = await calculate('=ISFORMULA(#NAME?)');
+
+ expect(result).toBe(ErrorType.NAME);
+ });
+
+ it('value is not reference', async () => {
+ const result = await calculate('=ISFORMULA("test")');
+
+ expect(result).toBe(ErrorType.NA);
+ });
+ });
+});
diff --git a/packages/engine-formula/src/functions/information/isformula/index.ts b/packages/engine-formula/src/functions/information/isformula/index.ts
new file mode 100644
index 0000000000..6f8e3b101a
--- /dev/null
+++ b/packages/engine-formula/src/functions/information/isformula/index.ts
@@ -0,0 +1,61 @@
+/**
+ * Copyright 2023-present DreamNum Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { ErrorType } from '../../../basics/error-type';
+import type { BaseReferenceObject, FunctionVariantType } from '../../../engine/reference-object/base-reference-object';
+import type { ArrayValueObject } from '../../../engine/value-object/array-value-object';
+import { type BaseValueObject, ErrorValueObject } from '../../../engine/value-object/base-value-object';
+import { BooleanValueObject } from '../../../engine/value-object/primitive-object';
+import { BaseFunction } from '../../base-function';
+
+export class Isformula extends BaseFunction {
+ override minParams = 1;
+
+ override maxParams = 1;
+
+ override needsReferenceObject = true;
+
+ override calculate(reference: FunctionVariantType): BaseValueObject {
+ if (reference.isError()) {
+ return reference as ErrorValueObject;
+ }
+
+ if (!reference.isReferenceObject()) {
+ return ErrorValueObject.create(ErrorType.NA);
+ }
+
+ const cellDataMatrix = (reference as BaseReferenceObject).getCurrentActiveSheetData()?.cellData.getMatrix();
+ const { startRow, startColumn } = (reference as BaseReferenceObject).getRangePosition();
+
+ const _reference = (reference as BaseReferenceObject).toArrayValueObject();
+
+ const resultArray = _reference.mapValue((valueObject, rowIndex, columnIndex) => {
+ const cellData = cellDataMatrix?.[startRow + rowIndex]?.[startColumn + columnIndex];
+
+ if (cellData?.f || cellData?.si) {
+ return BooleanValueObject.create(true);
+ }
+
+ return BooleanValueObject.create(false);
+ });
+
+ if (_reference.getRowCount() === 1 && _reference.getColumnCount() === 1) {
+ return (resultArray as ArrayValueObject).get(0, 0) as BaseValueObject;
+ }
+
+ return resultArray;
+ }
+}
diff --git a/packages/engine-formula/src/functions/information/n/__tests__/index.spec.ts b/packages/engine-formula/src/functions/information/n/__tests__/index.spec.ts
new file mode 100644
index 0000000000..7a54515ef6
--- /dev/null
+++ b/packages/engine-formula/src/functions/information/n/__tests__/index.spec.ts
@@ -0,0 +1,83 @@
+/**
+ * Copyright 2023-present DreamNum Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { describe, expect, it } from 'vitest';
+
+import { FUNCTION_NAMES_INFORMATION } from '../../function-names';
+import { ArrayValueObject, transformToValueObject } from '../../../../engine/value-object/array-value-object';
+import { ErrorType } from '../../../../basics/error-type';
+import { N } from '../index';
+import { BooleanValueObject, NullValueObject, NumberValueObject, StringValueObject } from '../../../../engine/value-object/primitive-object';
+import { ErrorValueObject } from '../../../../engine/value-object/base-value-object';
+
+describe('Test n function', () => {
+ const testFunction = new N(FUNCTION_NAMES_INFORMATION.N);
+
+ describe('N', () => {
+ it('Value is normal number', () => {
+ const value = NumberValueObject.create(1);
+ const result = testFunction.calculate(value);
+ expect(result.getValue()).toBe(1);
+ });
+
+ it('Value is number string', () => {
+ const value = StringValueObject.create('1.5');
+ const result = testFunction.calculate(value);
+ expect(result.getValue()).toBe(0);
+ });
+
+ it('Value is normal string', () => {
+ const value = StringValueObject.create('test');
+ const result = testFunction.calculate(value);
+ expect(result.getValue()).toBe(0);
+ });
+
+ it('Value is boolean', () => {
+ const value = BooleanValueObject.create(true);
+ const result = testFunction.calculate(value);
+ expect(result.getValue()).toBe(1);
+ });
+
+ it('Value is blank cell', () => {
+ const value = NullValueObject.create();
+ const result = testFunction.calculate(value);
+ expect(result.getValue()).toBe(0);
+ });
+
+ it('Value is error', () => {
+ const value = ErrorValueObject.create(ErrorType.NAME);
+ const result = testFunction.calculate(value);
+ expect(result.getValue()).toBe(ErrorType.NAME);
+ });
+
+ it('Value is array', () => {
+ const valueArray = ArrayValueObject.create({
+ calculateValueList: transformToValueObject([
+ [1, ' ', 1.23, true, false, null],
+ [0, '100', '2.34', 'test', -3, ErrorType.NAME],
+ ]),
+ rowCount: 2,
+ columnCount: 6,
+ unitId: '',
+ sheetId: '',
+ row: 0,
+ column: 0,
+ });
+ const result = testFunction.calculate(valueArray);
+ expect(result.getValue()).toBe(1);
+ });
+ });
+});
diff --git a/packages/engine-formula/src/functions/information/n/index.ts b/packages/engine-formula/src/functions/information/n/index.ts
new file mode 100644
index 0000000000..c02143830a
--- /dev/null
+++ b/packages/engine-formula/src/functions/information/n/index.ts
@@ -0,0 +1,46 @@
+/**
+ * Copyright 2023-present DreamNum Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import type { ArrayValueObject } from '../../../engine/value-object/array-value-object';
+import type { BaseValueObject } from '../../../engine/value-object/base-value-object';
+import { NumberValueObject } from '../../../engine/value-object/primitive-object';
+import { BaseFunction } from '../../base-function';
+
+export class N extends BaseFunction {
+ override minParams = 1;
+
+ override maxParams = 1;
+
+ override calculate(value: BaseValueObject): BaseValueObject {
+ let _value = value;
+
+ if (value.isArray()) {
+ _value = (value as ArrayValueObject).get(0, 0) as BaseValueObject;
+ }
+
+ if (_value.isError()) {
+ return _value;
+ }
+
+ if (_value.isString()) {
+ return NumberValueObject.create(0);
+ }
+
+ const val = +_value.getValue();
+
+ return NumberValueObject.create(val);
+ }
+}
diff --git a/packages/engine-formula/src/functions/information/na/__tests__/index.spec.ts b/packages/engine-formula/src/functions/information/na/__tests__/index.spec.ts
new file mode 100644
index 0000000000..1e9e952089
--- /dev/null
+++ b/packages/engine-formula/src/functions/information/na/__tests__/index.spec.ts
@@ -0,0 +1,32 @@
+/**
+ * Copyright 2023-present DreamNum Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { describe, expect, it } from 'vitest';
+
+import { FUNCTION_NAMES_INFORMATION } from '../../function-names';
+import { Na } from '../index';
+import { ErrorType } from '../../../../basics/error-type';
+
+describe('Test na function', () => {
+ const testFunction = new Na(FUNCTION_NAMES_INFORMATION.NA);
+
+ describe('Na', () => {
+ it('function is normal', () => {
+ const result = testFunction.calculate();
+ expect(result.getValue()).toBe(ErrorType.NA);
+ });
+ });
+});
diff --git a/packages/engine-formula/src/functions/information/na/index.ts b/packages/engine-formula/src/functions/information/na/index.ts
new file mode 100644
index 0000000000..189f2d94ca
--- /dev/null
+++ b/packages/engine-formula/src/functions/information/na/index.ts
@@ -0,0 +1,29 @@
+/**
+ * Copyright 2023-present DreamNum Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { ErrorType } from '../../../basics/error-type';
+import { ErrorValueObject } from '../../../engine/value-object/base-value-object';
+import { BaseFunction } from '../../base-function';
+
+export class Na extends BaseFunction {
+ override minParams = 0;
+
+ override maxParams = 0;
+
+ override calculate() {
+ return ErrorValueObject.create(ErrorType.NA);
+ }
+}
diff --git a/packages/sheets-formula/src/locale/function-list/information/en-US.ts b/packages/sheets-formula/src/locale/function-list/information/en-US.ts
index 4fd02f3f23..29354ea149 100644
--- a/packages/sheets-formula/src/locale/function-list/information/en-US.ts
+++ b/packages/sheets-formula/src/locale/function-list/information/en-US.ts
@@ -118,8 +118,7 @@ export default {
},
],
functionParameter: {
- number1: { name: 'number1', detail: 'first' },
- number2: { name: 'number2', detail: 'second' },
+ reference: { name: 'reference', detail: 'Reference is a reference to the cell you want to test.' },
},
},
ISLOGICAL: {
@@ -237,8 +236,7 @@ export default {
},
],
functionParameter: {
- number1: { name: 'number1', detail: 'first' },
- number2: { name: 'number2', detail: 'second' },
+ value: { name: 'value', detail: 'The value you want converted.' },
},
},
NA: {
@@ -251,8 +249,6 @@ export default {
},
],
functionParameter: {
- number1: { name: 'number1', detail: 'first' },
- number2: { name: 'number2', detail: 'second' },
},
},
SHEET: {
diff --git a/packages/sheets-formula/src/locale/function-list/information/ja-JP.ts b/packages/sheets-formula/src/locale/function-list/information/ja-JP.ts
index 52b0c2a9f2..fb2ea85574 100644
--- a/packages/sheets-formula/src/locale/function-list/information/ja-JP.ts
+++ b/packages/sheets-formula/src/locale/function-list/information/ja-JP.ts
@@ -118,8 +118,7 @@ export default {
},
],
functionParameter: {
- number1: { name: 'number1', detail: 'first' },
- number2: { name: 'number2', detail: 'second' },
+ reference: { name: '範囲', detail: '参照とは、テストするセルへの参照のことです。' },
},
},
ISLOGICAL: {
@@ -237,8 +236,7 @@ export default {
},
],
functionParameter: {
- number1: { name: 'number1', detail: 'first' },
- number2: { name: 'number2', detail: 'second' },
+ value: { name: '値', detail: '変換する値を指定します。' },
},
},
NA: {
@@ -251,8 +249,6 @@ export default {
},
],
functionParameter: {
- number1: { name: 'number1', detail: 'first' },
- number2: { name: 'number2', detail: 'second' },
},
},
SHEET: {
diff --git a/packages/sheets-formula/src/locale/function-list/information/vi-VN.ts b/packages/sheets-formula/src/locale/function-list/information/vi-VN.ts
index 317fb93a96..1a338b7efc 100644
--- a/packages/sheets-formula/src/locale/function-list/information/vi-VN.ts
+++ b/packages/sheets-formula/src/locale/function-list/information/vi-VN.ts
@@ -94,6 +94,19 @@ export default {
value: { name: 'Giá trị', detail: 'Giá trị cần kiểm tra. Nếu số không phải là số nguyên thì nó bị cắt cụt.' },
},
},
+ ISFORMULA: {
+ description: 'Kiểm tra xem liệu có tham chiếu đến ô chứa công thức hay không và trả về kết quả TRUE hoặc FALSE.',
+ abstract: 'Kiểm tra xem liệu có tham chiếu đến ô chứa công thức hay không và trả về kết quả TRUE hoặc FALSE.',
+ links: [
+ {
+ title: 'Hướng dẫn',
+ url: 'https://support.microsoft.com/vi-vn/office/isformula-%E5%87%BD%E6%95%B0-e4d1355f-7121-4ef2-801e-3839bfd6b1e5',
+ },
+ ],
+ functionParameter: {
+ reference: { name: 'tham chiếu', detail: 'Tham chiếu là tham chiếu đến ô mà bạn muốn kiểm tra.' },
+ },
+ },
ISLOGICAL: {
description: 'Trả về TRUE nếu giá trị là giá trị logic',
abstract: 'Trả về TRUE nếu giá trị là giá trị logic',
@@ -185,6 +198,31 @@ export default {
value: { name: 'Giá trị', detail: 'Giá trị mà bạn muốn kiểm tra. Đối số giá trị có thể là trống (ô trống), lỗi, giá trị lô-gic, văn bản, số, giá trị tham chiếu hoặc tên tham chiếu tới bất kỳ giá trị nào trong những giá trị này.' },
},
},
+ N: {
+ description: 'Trả về một giá trị được chuyển đổi thành số.',
+ abstract: 'Trả về một giá trị được chuyển đổi thành số.',
+ links: [
+ {
+ title: 'Hướng dẫn',
+ url: 'https://support.microsoft.com/vi-vn/office/n-%E5%87%BD%E6%95%B0-a624cad1-3635-4208-b54a-29733d1278c9',
+ },
+ ],
+ functionParameter: {
+ value: { name: 'giá trị', detail: 'Giá trị mà bạn muốn chuyển đổi.' },
+ },
+ },
+ NA: {
+ description: 'Trả về giá trị lỗi #N/A.',
+ abstract: 'Trả về giá trị lỗi #N/A.',
+ links: [
+ {
+ title: 'Hướng dẫn',
+ url: 'https://support.microsoft.com/vi-vn/office/na-%E5%87%BD%E6%95%B0-5469c2d1-a90c-4fb5-9bbc-64bd9bb6b47c',
+ },
+ ],
+ functionParameter: {
+ },
+ },
TYPE: {
description: 'Trả về một số đại diện cho kiểu dữ liệu của giá trị',
abstract: 'Trả về một số đại diện cho kiểu dữ liệu của giá trị',
diff --git a/packages/sheets-formula/src/locale/function-list/information/zh-CN.ts b/packages/sheets-formula/src/locale/function-list/information/zh-CN.ts
index e714eefd4a..3a43a260bc 100644
--- a/packages/sheets-formula/src/locale/function-list/information/zh-CN.ts
+++ b/packages/sheets-formula/src/locale/function-list/information/zh-CN.ts
@@ -118,8 +118,7 @@ export default {
},
],
functionParameter: {
- number1: { name: 'number1', detail: 'first' },
- number2: { name: 'number2', detail: 'second' },
+ reference: { name: '引用', detail: '是对要测试的单元格的引用。' },
},
},
ISLOGICAL: {
@@ -237,8 +236,7 @@ export default {
},
],
functionParameter: {
- number1: { name: 'number1', detail: 'first' },
- number2: { name: 'number2', detail: 'second' },
+ value: { name: '值', detail: '要转换的值。' },
},
},
NA: {
@@ -251,8 +249,6 @@ export default {
},
],
functionParameter: {
- number1: { name: 'number1', detail: 'first' },
- number2: { name: 'number2', detail: 'second' },
},
},
SHEET: {
diff --git a/packages/sheets-formula/src/locale/function-list/information/zh-TW.ts b/packages/sheets-formula/src/locale/function-list/information/zh-TW.ts
index 88044c4ba0..1fa44f4a00 100644
--- a/packages/sheets-formula/src/locale/function-list/information/zh-TW.ts
+++ b/packages/sheets-formula/src/locale/function-list/information/zh-TW.ts
@@ -109,8 +109,8 @@ export default {
},
},
ISFORMULA: {
- description: '如果有包含公式的單元格的引用,則傳回 TRUE',
- abstract: '如果有包含公式的單元格的引用,則傳回 TRUE',
+ description: '檢查是否有參照包含公式的儲存格,並傳回 TRUE 或 FALSE。',
+ abstract: '檢查是否有參照包含公式的儲存格,並傳回 TRUE 或 FALSE。',
links: [
{
title: '教導',
@@ -118,8 +118,7 @@ export default {
},
],
functionParameter: {
- number1: { name: 'number1', detail: 'first' },
- number2: { name: 'number2', detail: 'second' },
+ reference: { name: '參照', detail: '是您要測試之儲存格的參照。' },
},
},
ISLOGICAL: {
@@ -236,8 +235,7 @@ export default {
},
],
functionParameter: {
- number1: { name: 'number1', detail: 'first' },
- number2: { name: 'number2', detail: 'second' },
+ value: { name: '值', detail: '這是要轉換的值。' },
},
},
NA: {
@@ -250,8 +248,6 @@ export default {
},
],
functionParameter: {
- number1: { name: 'number1', detail: 'first' },
- number2: { name: 'number2', detail: 'second' },
},
},
SHEET: {
diff --git a/packages/sheets-formula/src/services/function-list/information.ts b/packages/sheets-formula/src/services/function-list/information.ts
index ed5f97bad7..4a407790c4 100644
--- a/packages/sheets-formula/src/services/function-list/information.ts
+++ b/packages/sheets-formula/src/services/function-list/information.ts
@@ -143,16 +143,9 @@ export const FUNCTION_LIST_INFORMATION: IFunctionInfo[] = [
abstract: 'formula.functionList.ISFORMULA.abstract',
functionParameter: [
{
- name: 'formula.functionList.ISFORMULA.functionParameter.number1.name',
- detail: 'formula.functionList.ISFORMULA.functionParameter.number1.detail',
- example: 'A1:A20',
- require: 1,
- repeat: 0,
- },
- {
- name: 'formula.functionList.ISFORMULA.functionParameter.number2.name',
- detail: 'formula.functionList.ISFORMULA.functionParameter.number2.detail',
- example: 'A1:A20',
+ name: 'formula.functionList.ISFORMULA.functionParameter.reference.name',
+ detail: 'formula.functionList.ISFORMULA.functionParameter.reference.detail',
+ example: 'A1',
require: 1,
repeat: 0,
},
@@ -292,16 +285,9 @@ export const FUNCTION_LIST_INFORMATION: IFunctionInfo[] = [
abstract: 'formula.functionList.N.abstract',
functionParameter: [
{
- name: 'formula.functionList.N.functionParameter.number1.name',
- detail: 'formula.functionList.N.functionParameter.number1.detail',
- example: 'A1:A20',
- require: 1,
- repeat: 0,
- },
- {
- name: 'formula.functionList.N.functionParameter.number2.name',
- detail: 'formula.functionList.N.functionParameter.number2.detail',
- example: 'A1:A20',
+ name: 'formula.functionList.N.functionParameter.value.name',
+ detail: 'formula.functionList.N.functionParameter.value.detail',
+ example: '7',
require: 1,
repeat: 0,
},
@@ -313,20 +299,6 @@ export const FUNCTION_LIST_INFORMATION: IFunctionInfo[] = [
description: 'formula.functionList.NA.description',
abstract: 'formula.functionList.NA.abstract',
functionParameter: [
- {
- name: 'formula.functionList.NA.functionParameter.number1.name',
- detail: 'formula.functionList.NA.functionParameter.number1.detail',
- example: 'A1:A20',
- require: 1,
- repeat: 0,
- },
- {
- name: 'formula.functionList.NA.functionParameter.number2.name',
- detail: 'formula.functionList.NA.functionParameter.number2.detail',
- example: 'A1:A20',
- require: 1,
- repeat: 0,
- },
],
},
{