> ## Documentation Index
> Fetch the complete documentation index at: https://help.dingtalk.io/llms.txt
> Use this file to discover all available pages before exploring further.

# SUM

> The SUM function performs summation, including summing subform columns. It applies to multiple YiDA scenarios such as Form, workflow design, and integration & automation. Given a list of numbers as arguments, it returns the total. Includes usage examples and a tip for conditional summation.

This topic describes the syntax, parameters, and usage examples of the SUM function, including how to sum a column of subform data.

## Supported Product Scenarios

The SUM function is supported in the following YiDA scenarios:

* Form (main form fields)
* Form (business association rules)
* Form (validation)
* Workflow design (validation rules)
* Workflow design (association actions)
* Integration & automation
* Workflow node
* Connector

## Format

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
SUM(number1,number2...numberN)
```

## Attributes

| Attribute | Required | Description                                                                                                                                                                    |
| --------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| number    | Yes      | Numbers to be summed. Separate multiple numbers with commas. <br />**Note**: To sum a column of subform data, pass the corresponding field as an argument to the SUM function. |

## Return Value

| Return type | Description                   |
| ----------- | ----------------------------- |
| Numerical   | The sum of the input numbers. |

## Examples

* Sum multiple Number components.

  As shown below, use `SUM()` to calculate the sum of `Number 1` and `Number 2`.

* Sum a column of subform data.

  As shown below, use `SUM()` to calculate the total travel allowance.

## Try It Out

Sum multiple Number components, or sum a Number component across multiple subform rows.

## Tip

Since no built-in `sumif` function is available, you can achieve a similar effect as shown below.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
sum(
  if(
    eq(subform.dropdown, "Venue fee"),
    subform.rentSubtotal,
    0
  )
)
```
