Forum Discussion
nalinkodithuwakku
Sep 23, 2024Copper Contributor
Excel Dynamic Formula
I added a formula to a cell using EPPLus C# as below. mySheet.Cells[rowNumber, columnNumber].CreateArrayFormula"UNIQUE(FILTER({sheetName}!C:C,{sheetName}!B:B = A{rowNumber}))")); When I open the ge...
SergeiBaklan
Sep 23, 2024MVP
You CreateArrayFormula, my guess it's the same as manually add formula with Ctrl+Shift+Enter. It will be with curly braces and returns only first element of dynamic array.
Try to create regular formula, not array one.
- nalinkodithuwakkuSep 23, 2024Copper Contributor
thanks for your response.
I tried with regular formula as well and then it comes with an additional @ sign which I need to delete manually to get the data populated.
Here is my code
var firstColumnFormula = $"UNIQUE({tailNumber}!B{firstDataRow}:B{lastDataRow})";
calculatedDataSheet.Cells[currentRow, currentCol].Formula = firstColumnFormula;and output is
=@UNIQUE(N175QS!B15:B599)- SergeiBaklanSep 23, 2024MVP
Try to use .Formula2 instead of .Formula. The latest assumes single value returned, thus implicit intersection operator ("@") is added.