MCPcopy
hub / github.com/exceljs/exceljs / getFormula

Method getFormula

lib/doc/table.js:81–107  ·  view source on GitHub ↗
(column)

Source from the content-addressed store, hash-verified

79 }
80
81 getFormula(column) {
82 // get the correct formula to apply to the totals row
83 switch (column.totalsRowFunction) {
84 case 'none':
85 return null;
86 case 'average':
87 return `SUBTOTAL(101,${this.table.name}[${column.name}])`;
88 case 'countNums':
89 return `SUBTOTAL(102,${this.table.name}[${column.name}])`;
90 case 'count':
91 return `SUBTOTAL(103,${this.table.name}[${column.name}])`;
92 case 'max':
93 return `SUBTOTAL(104,${this.table.name}[${column.name}])`;
94 case 'min':
95 return `SUBTOTAL(105,${this.table.name}[${column.name}])`;
96 case 'stdDev':
97 return `SUBTOTAL(106,${this.table.name}[${column.name}])`;
98 case 'var':
99 return `SUBTOTAL(107,${this.table.name}[${column.name}])`;
100 case 'sum':
101 return `SUBTOTAL(109,${this.table.name}[${column.name}])`;
102 case 'custom':
103 return column.totalsRowFormula;
104 default:
105 throw new Error(`Invalid Totals Row Function: ${column.totalsRowFunction}`);
106 }
107 }
108
109 get width() {
110 // width of the table

Callers 3

validateMethod · 0.95
storeMethod · 0.95
loadMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected