Formula Errors

How to Fix Curly Braces and Missing Results in EPPlus Dynamic Array Formulas

Tauseeq MagsiTauseeq Magsi Nov 10, 2026 869 views

Question details

The user is experiencing an issue where dynamic array formulas (like UNIQUE and FILTER) written using EPPlus appear with curly braces, and the full array results are missing.

How to Fix Curly Braces and Missing Results in EPPlus Dynamic Array Formulas
Product
Excel / EPPlus
Device & OS
not provided
Scenario
Generating an Excel workbook programmatically using the EPPlus library and inserting dynamic array formulas.
Observed behavior
Formulas are wrapped in curly braces and only return the first element instead of spilling the results, requiring manual editing to work properly.
Before you start

Ensure you are opening the generated workbook in a modern version of a spreadsheet application (such as Excel 365, Excel 2021, or WPS Office) that natively supports dynamic array spilling.

Solution 1Recommended

Write the Formula as a Regular Worksheet Formula

Avoid using the legacy CreateArrayFormula method, which produces outdated CSE (Ctrl+Shift+Enter) array formulas instead of modern dynamic arrays.

When you use the CreateArrayFormula method in EPPlus, it mimics the legacy Ctrl+Shift+Enter behavior. This forces the formula to be wrapped in curly braces {} and prevents modern dynamic array functions like UNIQUE and FILTER from automatically spilling across neighboring cells.

To resolve this, you must assign the formula directly to the cell's Formula property as a standard formula. Modern spreadsheet engines will automatically recognize it as a dynamic array and spill the results accordingly.

1
Locate the formula assignment code

Open your C# project and locate the line in your EPPlus code where you are applying the dynamic formula using the CreateArrayFormula() method.

2
Change to standard formula assignment

Replace the legacy array method with a direct string assignment to the Formula property. For example, use: worksheet.Cells["A1"].Formula = "UNIQUE(FILTER(A2:A10, B2:B10>0))";

3
Compile and run your project

Save your code, rebuild the application, and generate the Excel workbook again.

4
Verify the results

Open the newly generated .xlsx file. The curly braces should be gone, and the formula should naturally spill its results into the adjacent cells.

Write the Formula as a Regular Worksheet Formula
Calculation Status: If the formula displays an error or doesn't calculate upon opening, ensure you call workbook.Calculate() before saving in EPPlus, or verify that calculation options are set to Automatic in your spreadsheet software.
Free Microsoft Office alternative

View and Edit Dynamic Array Spreadsheets with WPS Office

If you are generating Excel files with dynamic array formulas like UNIQUE and FILTER, WPS Office provides a lightweight, highly compatible, and free alternative to Microsoft Excel for testing, viewing, and editing your workbooks.

  1. 1. Download WPS Office: Visit the official WPS Office website and download the free installer for your operating system.
  2. 2. Install and launch the application: Follow the installation prompts and open WPS Spreadsheet.
  3. 3. Open your generated file: Drag and drop your EPPlus-generated .xlsx file into WPS Spreadsheet to instantly verify your dynamic array formulas.
Seamless format compatibility with Microsoft Excel (.xlsx) filesNative support for modern dynamic array functions like UNIQUE and FILTERLightweight application that opens quickly for rapid developer testingFamiliar user interface requiring no learning curve
QA img-9

Frequently Asked Questions

Why do my Excel formulas have curly braces around them?

Curly braces {} indicate a legacy CSE (Ctrl+Shift+Enter) array formula. These were used in older versions of Excel to handle calculations processing multiple values, before dynamic arrays were introduced.

Does EPPlus support dynamic array formulas?

Yes, EPPlus supports modern dynamic array formulas. However, you must write them as standard formulas using the cell's .Formula property rather than the older CreateArrayFormula method, which is specifically designed for legacy CSE arrays.

Why is my dynamic array formula only showing the first result?

If a dynamic array formula is mistakenly entered as a legacy array formula, it will not spill over into adjacent cells. It becomes restricted to the specific cell or range it was explicitly assigned to, resulting in only the first item being displayed.