Forum Discussion
girishjedar
Oct 26, 2023Copper Contributor
Implicit intersection operator: @, breaking the excel generated from C# code
I am trying to generate a excel document, with a SUM total cell having a formula: =SUM(ROUNDUP(A1:A3,2)) But when I write a formula in C# code as shown below: workSheet.Cells[1, column.Val...
- Oct 28, 2023Yes, writing it as an array formula works for me:
worksheet.Range("A4:A4").FormulaArrayA1 = "=SUM(ROUNDUP(A1:A3,2))";
I use "using ClosedXML.Excel;" in csharp.
JKPieterse
Oct 26, 2023Silver Contributor
Your screenshot formula doesn't match the one in your text. That being said, the range object has a (set of) new Formula2 property/properties you should be using when placing Dynamic array-capable formulas into cells.
rachel
Oct 28, 2023Iron Contributor
Yes, writing it as an array formula works for me:
worksheet.Range("A4:A4").FormulaArrayA1 = "=SUM(ROUNDUP(A1:A3,2))";
I use "using ClosedXML.Excel;" in csharp.
worksheet.Range("A4:A4").FormulaArrayA1 = "=SUM(ROUNDUP(A1:A3,2))";
I use "using ClosedXML.Excel;" in csharp.
- girishjedarOct 30, 2023Copper ContributorYou are the best!!!! Thank you so much Rachel. ❤️