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: use number value in stats calculation (#4684)

lumix1811593d601e
diff --git a/packages/sheets-ui/src/controllers/status-bar.controller.ts b/packages/sheets-ui/src/controllers/status-bar.controller.ts
index 9c932cdb0e..d1921880bf 100644
--- a/packages/sheets-ui/src/controllers/status-bar.controller.ts
+++ b/packages/sheets-ui/src/controllers/status-bar.controller.ts
@@ -56,8 +56,9 @@ class CalculateValueSet {
private _max: number = Number.NEGATIVE_INFINITY;
add(value: Nullable<ICellData>, styles: Styles, patternInfoRecord: Record<string, any>) {
- const v = value?.v;
+ let v = value?.v;
const t = value?.t;
+ if (t === CellValueType.NUMBER) v = Number(v);
if (v !== undefined && v !== null) {
if (typeof v === 'number' && t !== CellValueType.STRING) {
this._sum += v;