# Set-OfficeExcelFormula

Sets a formula in a worksheet cell. Review available syntax, parameters, pipeline guidance, and reference details in PSWriteOffice API Reference.

Project

PSWriteOffice

PowerShell document automation across OfficeIMO's document, spreadsheet, presentation, PDF, Project, Access, EPUB, invoicing, and conversion engines.

[View on GitHub](https://github.com/EvotecIT/OfficeIMO/tree/master/PowerShell/PSWriteOffice) [Visit Website](#) [Releases](https://github.com/EvotecIT/PSWriteOffice/releases/tag/v3.0.5) [Changelog](#) [Get package](https://www.powershellgallery.com/packages/PSWriteOffice/0.2.0)

Stars **727**

Forks **84**

Open issues **7**

Total downloads **5,275,783**

Release **OfficeIMO-v3.6.2**

Language: C# Updated: 2026-11-24

Cmdlet 

Aliases: ExcelFormula

**Module**

`PSWriteOffice`

**Aliases**

`ExcelFormula`

**Inputs**

`None`

**Source**

[SetOfficeExcelFormulaCommand.cs:17](https://github.com/EvotecIT/PSWriteOffice/blob/main/Sources/PSWriteOffice/Cmdlets/Excel/SetOfficeExcelFormulaCommand.cs#L17) 

Sets a formula in a worksheet cell.

## Syntax

```
Set-OfficeExcelFormula
[-Column <Int32>]
-Formula <String>
[-PassThru]
[-Row <Int32>]
[<CommonParameters>]
```

[#](#method-set-officeexcelformula-int32-string-switchparameter-int32)

Parameter set: `Coordinates`

```
Set-OfficeExcelFormula
[-Address <String>]
-Formula <String>
[-PassThru]
[<CommonParameters>]
```

[#](#method-set-officeexcelformula-string-string-switchparameter)

Parameter set: `Address`

## Description

Supports A1 addresses or row/column coordinates in the Excel DSL.

## Examples

### Write a SUM formula.

```powershell
ExcelSheet 'Data' { Set-OfficeExcelFormula -Address 'C2' -Formula 'SUM(A2:B2)' }
```

Stores the formula in cell C2.

## Parameters

**-Column Int32 optionalsets: Coordinates**

1-based column index.

**-Formula String required**

Formula text (without leading =).

**-PassThru SwitchParameter optional**

Emit the object created or changed by the command.

**-Row Int32 optionalsets: Coordinates**

1-based row index.

**-Address String optionalsets: Address**

A1-style cell address (e.g., A1, C5).

## Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see [about_CommonParameters](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters).

Evotec API Reference Copyright 2026 Evotec Services

<!-- PowerForge markdown artifact sha256:3B0C9D508E1C8549273B68C3C3808C3D97FE36CE94E1B7E816D26AB7DD25F6CA -->
