# spreadsheet-editor-formula

> Spreadsheet editor with formulas, named ranges, computed profit, and summary rows.

**Framework:** vue  **Component:** SpreadsheetEditor  **Variant:** formula

## Get this item

**If you are an agent, fetch the JSON.** Source is inlined, so one request is enough and no tooling is required:

```
GET https://ai.syncfusion.com/r/vue/spreadsheet-editor-formula.json
```

**Install Package(s)**

```bash
npm install @syncfusion/ej2-vue-spreadsheet
```

**Notes**

- Syncfusion release: 2026 Volume 3 (v35.1.37)
- The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md

## Source files

### src/components/spreadsheet-editor-formula/SpreadSheetEditor.vue

```vue
<template>
  <div class="control-section">
    <div id="spreadsheet-number-format">
      <ejs-spreadsheet ref="spreadsheet" :showRibbon="false" :created="created">
        <e-sheets>
          <e-sheet name="Stock Details" selectedRange="F10">
            <e-ranges>
              <e-range :dataSource="dataSource"></e-range>
            </e-ranges>
            <e-rows>
              <e-row :height="height1"></e-row>
              <e-row :index="rowIndex" :height="height2">
                <e-cells>
                  <e-cell :index="colIndex1" value="Average profit:"></e-cell>
                  <e-cell :index="colIndex2" formula="=AVERAGE(F2:F6)" format="0.00"></e-cell>
                </e-cells>
              </e-row>
              <e-row :height="height2">
                <e-cells>
                  <e-cell :index="colIndex1" value="Maximum stock value:"></e-cell>
                  <e-cell :index="colIndex2" formula="=MAX(D2:D6)" format="0.00"></e-cell>
                </e-cells>
              </e-row>
              <e-row :height="height2">
                <e-cells>
                  <e-cell :index="colIndex1" value="Minimum stock value:"></e-cell>
                  <e-cell :index="colIndex2" formula="=MIN(E2:E6)" format="0.00"></e-cell>
                </e-cells>
              </e-row>
              <e-row :height="height2">
                <e-cells>
                  <e-cell :index="colIndex1" value="Non-profitable days:"></e-cell>
                  <e-cell :index="colIndex2" formula='=COUNTIF(F2:F6,"<=0")' ></e-cell>
                </e-cells>
              </e-row>
            </e-rows>
            <e-columns>
              <e-column :width="width1"></e-column>
              <e-column :width="width2"></e-column>
              <e-column :width="width3"></e-column>
              <e-column :width="width3"></e-column>
              <e-column :width="width2"></e-column>
              <e-column :width="width2"></e-column>
            </e-columns>
          </e-sheet>
        </e-sheets>
      </ejs-spreadsheet>
    </div>
  </div>
</template>

<script>
import { SpreadsheetComponent, SheetDirective, RowsDirective, RowDirective, CellDirective, CellsDirective, SheetsDirective, ColumnsDirective, ColumnDirective, RangesDirective, RangeDirective } from '@syncfusion/ej2-vue-spreadsheet';
import { stockDetailsData } from '../datasource/spreadsheet-editor-data';

export default {
   components: {
    'ejs-spreadsheet': SpreadsheetComponent,
    'e-sheet': SheetDirective,
    'e-sheets': SheetsDirective,
    'e-row': RowDirective,
    'e-rows': RowsDirective,
    'e-cell': CellDirective,
    'e-cells': CellsDirective,
    'e-column': ColumnDirective,
    'e-columns': ColumnsDirective,
    'e-range': RangeDirective,
    'e-ranges': RangesDirective
   },
   data: () => {
    return {
      dataSource: stockDetailsData,
      rowIndex: 6,
      height1: 40,
      height2: 25,
      colIndex1: 3,
      colIndex2: 5,
      width1: 100,
      width2: 130,
      width3: 140,
      definedNames: [
        { name: 'Profit', refersTo: '=F2:F6' },
        { name: 'High', refersTo: '=D2:D6' }
      ]
    }
  },
  methods: {
    created: function() {
        var spreadsheet = this.$refs.spreadsheet;
        spreadsheet.cellFormat({ fontWeight: 'bold', backgroundColor: '#279377', color: '#fff', textAlign: 'center',verticalAlign: 'middle', fontSize: '14px' }, 'A1:F1');
        spreadsheet.cellFormat({ fontWeight: 'bold', backgroundColor: '#EEEEEE' }, 'A7:F10');
        spreadsheet.numberFormat('0.00', 'F2:F6');
        spreadsheet.numberFormat('m/d/yyyy', 'A2:A6');
    }
  }
}
</script>
```
