Streaming live at 10am (PST)

Sum up values from number-fields in collection

Hi there,

I have a collection with a number field.
The numbers vary between 10 and 300.000

I’d like to add up all numbers and show this number somewhere.
Possibility is that i have to use pagination to show the entire collection, so i think i can’t use jquery.

Is there another way to display all summed up values from one (number)fiels of an entire collection?

1 Like

Why is it that no-one has a simple answer to a simple sum function?
I can’t be the only one with this request.

As seen in other questions here, there is some progress being made here: Math using CMS fields
But i need more examples/methods things to calculate.

1 Like

Hey @icexuick,
This would require custom code. Check this thread here: Calculate and return values based on user input from Webflow form as it looks like @pepperclip and @Mitchell_Joseph solved it.

Thx. I have asked there. But this is all a bit too little ‘no-code’ for me.
I have done some slight tweaks in JS, but i can’t build my own arrays of collection items… (yet).

I could also do a workaround through Airtable for example, and calc the amount there in a separate table/col with their “rollup” feature, and put that back into webflow in a separate collection & item.

But that would require me to automate all this, which i think is overkill for just a simple “sum” thing.

Yeah, I feel your frustration… Webflow’s system is so powerful yet you quickly hit limits that feel like they should have been removed 20 years ago. There are quite a few example like that, but nonetheless there often are workarounds (especially thanks to the community). Hopefully you’ll manage to get this issue solved, but I can’t help you further unfortunately as I’m no dev either (hence why I feel your frustration perfectly :sweat_smile: ).

1 Like

This worked for me.

Include this jq script to your header.

var items = ('.crew-count'), itemTotal = (’.crew-total’),
sum = 0;

$.each(items, function(value) {
var itemValue = parseFloat(items[value].innerHTML);
sum += !isNaN(itemValue) ? itemValue : 0;