Getting "=@FILTER(.." In Excel from PowerShell Formula

The @ is the implicit intersection operator.

Functions that return multi-cell ranges or arrays (which FILTER can) will be prefixed with ‘@’ if they were authored in an older version of Excel (which, I’m guessing, includes the COM object).

From looking at Get-Member on the cell. There’s a second property Formula2 that stores the function with the ‘@’ included.

PS E:\Temp> $worksheet.Cells.Item(10,4).Formula = '=A1:A5'
PS E:\Temp> $worksheet.Cells.Item(10,4) | Select Formula,Formula2

Formula Formula2
------- --------
=A1:A5  =@A1:A5

Setting the Formula2 property instead of Formula sets the function without inserting the ‘@’.

PS E:\Temp> $worksheet.Cells.Item(10,5).Formula2 = '=A1:A5'
PS E:\Temp> $worksheet.Cells.Item(10,5) | Select Formula,Formula2

Formula Formula2
------- --------
=A1:A5  =A1:A5

Obviously you’ll need to test to see if that breaks anything and read the ’ Can you remove the @?’ section in the linked document to understand the implications.

2 Likes