ComfyUI Node: sum

Class Name

Basic data handling: DataListSum

Category
Basic/Data List
Author
StableLlama (Account age: 861days)
Extension
Basic data handling
Latest Updated
2026-05-07
Github Stars
0.04K

How to Install Basic data handling

Install this extension via the ComfyUI Manager by searching for Basic data handling
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter Basic data handling in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

sum Description

DataListSum node computes the sum of list elements, handling mixed types and optional start value.

sum:

The DataListSum node is designed to efficiently compute the sum of all elements within a data list, providing a straightforward way to aggregate numerical data. This node is particularly useful when you need to quickly obtain the total of a series of numbers, whether they are integers or floats, within a list. It simplifies the process by automatically handling both empty lists and lists with mixed number types, ensuring that you always receive a valid sum. The node also allows for an optional starting value, which can be added to the sum of the list elements, offering flexibility in calculations. This feature is especially beneficial for AI artists who need to perform quick arithmetic operations on data lists without delving into complex programming logic.

sum Input Parameters:

list

The list parameter is a required input that represents the data list containing the numerical elements you wish to sum. This parameter accepts a list of numbers, which can include both integers and floats. The node processes each element in the list to compute the total sum. If the list is empty, the node will return a sum of zero. There are no specific minimum or maximum values for this parameter, as it is designed to handle any list of numbers provided.

start

The start parameter is an optional input that specifies an initial value to be added to the sum of the list elements. By default, this value is set to 0, meaning that if you do not provide a start value, the node will simply sum the elements of the list. This parameter is particularly useful when you need to include a base value in your calculations, such as an offset or an initial total. The start parameter accepts integer values, and while there is no explicit maximum value, it should be chosen based on the context of your calculation needs.

sum Output Parameters:

int_sum

The int_sum output parameter provides the integer representation of the total sum of the list elements, including the optional start value. This output is particularly useful when you need a whole number result from your summation, even if the list contains float values. The int_sum ensures that any fractional parts are discarded, providing a clean integer result.

float_sum

The float_sum output parameter offers the floating-point representation of the total sum, which includes the optional start value. This output is essential when precision is required, as it retains any decimal points from the summation of float elements in the list. The float_sum is ideal for scenarios where the exact total, including fractional values, is necessary for further processing or analysis.

sum Usage Tips:

  • Use the start parameter to include an initial value in your sum, which can be helpful for cumulative calculations or when integrating with other data sources.
  • When working with lists containing mixed number types, rely on the float_sum output to ensure precision and avoid losing important decimal information.
  • If you anticipate working with empty lists, remember that the node will return the start value as the sum, allowing you to handle such cases gracefully.

sum Common Errors and Solutions:

TypeError: unsupported operand type(s) for +: 'int' and 'str'

  • Explanation: This error occurs when the list contains non-numeric elements, such as strings, which cannot be summed with numbers.
  • Solution: Ensure that all elements in the list are numeric (integers or floats) before passing it to the node.

ValueError: invalid literal for int() with base 10

  • Explanation: This error might occur if the start parameter is provided as a non-integer value that cannot be converted to an integer.
  • Solution: Verify that the start parameter is an integer or can be safely converted to an integer.

Empty list with no start value

  • Explanation: If the list is empty and no start value is provided, the node will return a sum of zero.
  • Solution: If a non-zero result is desired for an empty list, provide a start value to be used as the sum.

sum Related Nodes

Go back to the extension to check out more related nodes.
Basic data handling
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.

sum