# Sneak Peek X16: Excel Formulas and MailMerge

> TX Text Control X16 supports over 100 Excel-compatible formulas in table cells combined with the MailMerge reporting engine. Formulas calculate line totals, sums, averages, and item counts within merged document templates, removing the need to precompute derived data values.

- **Author:** Bjoern Meyer
- **Published:** 2018-10-30
- **Modified:** 2026-07-17
- **Description:** TX Text Control X16 supports over 100 Excel-compatible formulas in table cells combined with the MailMerge reporting engine. Formulas calculate line totals, sums, averages, and item counts within merged document templates, removing the need to precompute derived data values.
- **2 min read** (394 words)
- **Tags:**
  - Excel
  - Release
  - Reporting
  - Tables
- **Web URL:** https://www.textcontrol.com/blog/2018/10/30/sneak-peel-x16-excel-formulas-and-mailmerge/
- **LLMs URL:** https://www.textcontrol.com/blog/2018/10/30/sneak-peel-x16-excel-formulas-and-mailmerge/llms.txt
- **LLMs-Full URL:** https://www.textcontrol.com/blog/2018/10/30/sneak-peel-x16-excel-formulas-and-mailmerge/llms-full.txt

---

In TX Text Control X16, Excel compatible formulas can be used in table cells to calculate results based on values and references to other cells in the same table. More than 100 different formulas are supported and can be combined.

This feature gets even more powerful when used in combination with TXTextControl.DocumentServer.MailMerge class- TX Text Control's reporting engine to merge templates with data from various data sources.

The following screenshot shows a list of invoice items created with *MailMerge*:

![Invoice with Excel formulas](https://s1-www.textcontrol.com/assets/dist/blog/2018/10/30/a/assets/invoice_merged.webp "Invoice with Excel formulas")

The data for this example is a very simple XML:

```
<data>
    <invoice>
        <item>
            <qty>1</qty>
            <name>Road-650 Red, 44</name>
            <unit_price>419.4589</unit_price>
            <discount>0</discount>
        </item>
        <item>
            <qty>5</qty>
            <name>Road-450 Red, 52</name>
            <unit_price>809.76</unit_price>
            <discount>0</discount>
        </item>
        <item>
            <qty>1</qty>
            <name>HL Mountain Frame - Black, 38</name>
            <unit_price>714.7043</unit_price>
            <discount>12</discount>
        </item>
        <item>
            <qty>2</qty>
            <name>AWC Logo Cap</name>
            <unit_price>5.1865</unit_price>
            <discount>0</discount>
        </item>
        <item>
            <qty>10</qty>
            <name>Mountain-100 Black, 38</name>
            <unit_price>2024.994</unit_price>
            <discount>20</discount>
        </item>
        <item>
            <qty>13</qty>
            <name>Sport-100 Helmet, Blue</name>
            <unit_price>20.1865</unit_price>
            <discount>2</discount>
        </item>
    </invoice>
</data>
```

In the above XML source, you can see that only 4 data points are available:

- qty
- name
- unit\_price
- discount

The other columns in the table are calculated based on these values.

![Invoice with Excel formulas](https://s1-www.textcontrol.com/assets/dist/blog/2018/10/30/a/assets/invoice_animation.webp "Invoice with Excel formulas")

The following screenshot shows the formula of the *Line Total* column in the ribbon UI. The value is calculated based on quantity multiplied the unit price minus discount.

![Invoice with Excel formulas](https://s1-www.textcontrol.com/assets/dist/blog/2018/10/30/a/assets/formula_linetotal.webp "Invoice with Excel formulas")

The *Total* value is calculated with the following formula that creates a sum of all numeric rows above in the same column:

*SUM(ABOVE)*

Additionally, two values are calculated based on the existing data in the table.

- Average discount:  
    *SUM(ABOVE)/COUNT(ABOVE)*
- Number of items:  
    *COUNT(ABOVE)-1*

In this sample template, another new feature of *MailMerge* is used: Sorting. The complete list is sorted by unit price:

![Invoice with Excel formulas](https://s1-www.textcontrol.com/assets/dist/blog/2018/10/30/a/assets/sorting.webp "Invoice with Excel formulas")

This sample shows the power of *MailMerge* in combination with Microsoft Excel compatible formulas. The major advantage of using formulas is that data, that could be calculated, must not be stored in your data source or must not be calculated in your business object. TX Text Control is doing this for you when the data is required.

Another great idea of TX Text Control X16 - stay tuned for more.

---

## About Bjoern Meyer

As CEO, Bjoern is the visionary behind our strategic direction and business development, bridging the gap between our customers and engineering teams. His deep passion for coding and web technologies drives the creation of innovative products. If you're at a tech conference, be sure to stop by our booth - you'll most likely meet Bjoern in person. With an advanced graduate degree (Dipl. Inf.) in Computer Science, specializing in AI, from the University of Bremen, Bjoern brings significant expertise to his role. In his spare time, Bjoern enjoys running, paragliding, mountain biking, and playing the piano.

- [LinkedIn](https://www.linkedin.com/in/bjoernmeyer/)
- [X](https://x.com/txbjoern)
- [GitHub](https://github.com/bjoerntx)

---

## Series

- **Sneak Peek X16: Excel Formulas and MailMerge** (this article)
- [Sneak Peek X16: MS Word Compatible Track Changes](https://www.textcontrol.com/blog/2018/04/24/sneak-peek-x16-ms-word-compatible-track-changes/llms.txt)
- [Sneak Peek X16: Filter and Sort MergeBlock Rows](https://www.textcontrol.com/blog/2018/04/26/sneak-peek-x16-filter-and-sort-mergeblock-rows/llms.txt)
- [Sneak Peek X16: New Customizable Sidebar Controls](https://www.textcontrol.com/blog/2018/05/02/sneak-peek-x16-new-customizable-sidebar-controls/llms.txt)
- [Sneak Peek X16: Working with Formulas in Table Cells](https://www.textcontrol.com/blog/2018/07/25/sneak-peek-working-with-formulas-in-table-cells/llms.txt)
- [Sneak Peek X16: Selecting Reference Cells for Table Formulas](https://www.textcontrol.com/blog/2018/10/03/sneak-peek-x16-select-reference-cells-for-table-formulas/llms.txt)

---

## Related Posts

- [ReportingCloud: Backend Updated to TX Text Control X16](https://www.textcontrol.com/blog/2019/01/03/impact-of-the-azure-reboot-strategy/llms.txt)
- [Automatically Format Numbers in Table Cells](https://www.textcontrol.com/blog/2018/12/10/automatically-format-numbers-in-table-cells/llms.txt)
- [Opening Microsoft Excel files with TX Text Control X16](https://www.textcontrol.com/blog/2018/11/15/opening-microsoft-excel-files-with-tx-text-control-x16/llms.txt)
- [Loading and Processing Excel XLSX Spreadsheet Tables into TX Text Control using .NET C#](https://www.textcontrol.com/blog/2024/10/16/loading-and-processing-excel-spreadsheet-tables-into-tx-text-control-using-net-csharp/llms.txt)
- [TX Text Control 32.0 Has Been Released](https://www.textcontrol.com/blog/2023/09/13/tx-text-control-320-has-been-released/llms.txt)
- [Importing Excel XLSX Spreadsheets into TX Text Control in ASP.NET Core and Windows Forms in C#](https://www.textcontrol.com/blog/2023/02/07/importing-excel-xlsx-spreadsheets-into-tx-text-control/llms.txt)
- [TX Text Control 31.0 and TX Spell .NET 10.0 Have Been Released](https://www.textcontrol.com/blog/2022/09/07/tx-text-control-31-released/llms.txt)
- [TX Text Control 30.0 and TX Spell .NET 9.0 Have Been Released](https://www.textcontrol.com/blog/2021/11/29/tx-text-control-30-released/llms.txt)
- [TX Text Control X19 and TX Spell 8.0 Have Been Released](https://www.textcontrol.com/blog/2020/12/02/tx-text-control-x19-released/llms.txt)
- [TX Text Control for Angular X18 Published](https://www.textcontrol.com/blog/2020/03/18/tx-text-control-for-angular-x18-published/llms.txt)
- [MVC NuGet Packages for X18 Published](https://www.textcontrol.com/blog/2020/03/17/mvc-nuget-packages-for-x18-published/llms.txt)
- [TX Text Control X18 has been Released](https://www.textcontrol.com/blog/2020/03/16/tx-text-control-x18-released/llms.txt)
- [Sneak Peek X18: Form Field Conditional Instructions](https://www.textcontrol.com/blog/2020/01/03/sneak-peek-x18-form-field-conditional-instructions/llms.txt)
- [DocumentViewer: New Two Page View Mode](https://www.textcontrol.com/blog/2020/01/02/documentviewer-new-two-page-view-mode/llms.txt)
- [See Text Control at DDC in Cologne](https://www.textcontrol.com/blog/2019/11/24/see-text-control-at-ddc-in-cologne/llms.txt)
- [Impressions from DEVintersection Fall 2019](https://www.textcontrol.com/blog/2019/11/22/impressions-from-devintersection-fall-2019/llms.txt)
- [Impressions from TechBash 2019](https://www.textcontrol.com/blog/2019/11/14/impressions-from-techbash-2019/llms.txt)
- [Merge Excel Documents into MailMerge Templates using IncludeText Fields](https://www.textcontrol.com/blog/2019/08/13/merge-excel-documents-into-mailmerge-templates/llms.txt)
- [TX Text Control X17 has been Released](https://www.textcontrol.com/blog/2019/05/28/tx-text-control-x17-released/llms.txt)
- [Text Control Roadmap 2019: High DPI Support, Forms, Node.js and Angular](https://www.textcontrol.com/blog/2019/03/12/text-control-roadmap-2019/llms.txt)
- [Impressions from BASTA! Spring 2019](https://www.textcontrol.com/blog/2019/03/01/impressions-from-basta-spring-2019/llms.txt)
- [Impressions from NDC London 2019](https://www.textcontrol.com/blog/2019/02/04/impressions-from-ndc-london-2019/llms.txt)
- [MailMerge: Conditional Rendering of Merge Blocks](https://www.textcontrol.com/blog/2018/11/28/mailmerge-conditional-rendering-of-merge-blocks/llms.txt)
- [DataSourceManager: Using the Ready-to-Use Reporting Dialog Boxes](https://www.textcontrol.com/blog/2018/11/27/datasourcemanager-using-the-ready-to-use-reporting-dialog-boxes/llms.txt)
- [Merge Blocks in X16: Filtering, Sorting and Conditional Rendering](https://www.textcontrol.com/blog/2018/11/22/merge-blocks-in-x16-filtering-sorting-and-conditional-rendering/llms.txt)
