PowerShell to Excel: Getting '@' in Formula - ?

Jason Cannon 21 Reputation points
2021-05-25T14:52:25.353+00:00

I am trying to run an “=FILTER(…)” formula created in a PowerShell script that should spill over and use additional rows and columns. But it is not. Instead I get “=@FILTER(…)” in the cell.

I can manually remove the “@”, press enter, and the formula works.

So, why do I get the ‘@’ ?

My code:

$a = 2
$b = $rec_count
$c = (import-csv $File).count + 1

$ExcelWorksheet.cells.Item(2,3).Formula = ‘=FILTER(ALL!A’+$a+’:K’+$b+’,ISNUMBER(XMATCH(ALL!G’+$a+’:G’+$b+’,“CLOSE”)+XMATCH(ALL!E’+$a+’:E’+$b+’,A’+$a+’:A’+$c+’)+SEARCH(“auto closed duplicate”,ALL!C’+$a+’:C’+$b+’)))’

Any help and/or advice would be greatly appreciated.

Thanks.

Windows for business Windows Server User experience PowerShell
{count} votes

Accepted answer
  1. Anonymous
    2021-05-26T02:47:21.083+00:00

    Hi,

    This could be helpful.
    Implicit intersection operator: @

    Best Regards,
    Ian Xue

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Jason Cannon 21 Reputation points
    2021-05-26T11:15:59.243+00:00

    Yes, thank you. That does explain the @ better than anything I was able to find.

    And I was able to get the fix for my problem here:

    https://forums.powershell.org/t/getting-filter-in-excel-from-powershell-formula/16648

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.