Hi,
I’m storing values in a Zapier Storage as a list.
Is there a way to add all these values together? Struggling to work this one out.
Hi,
I’m storing values in a Zapier Storage as a list.
Is there a way to add all these values together? Struggling to work this one out.
Best answer by DanversBest answer by Danvers
Hi
Do you meant that you’d like to add them together mathematically (ie they are numbers and you want to add them together)? To answer this I’m going to have to make a couple of assumptions, I hope that’s ok. If I have anything wrong, just let me know!
You mentioned that you’re storing values as a list, so I’m assuming that you’re using the action Storage by Zapier action Push Value onto list.
Based on that, here’s how you can get the items off the list and add them together.
First, add a Storage by Zapier Get List Values action to the Zap. Set it up so that it’s getting the values from your list and that the item format is %s,
That means that when this action runs, the output will be all of the items in the list with a comma after each item (eg 34, 22, 904,)
Next you’ll need a Formatter by Zapier action. Choose ‘Numbers’ for the event and ‘Spreadsheet style formula’ for the Transform. This action allows you to create the type of formula that you’d use in a spreadsheet (eg Excel or Google Docs). In the Formula box, type in =sum(
then add the output of from the Storage step, followed by )
When this action is run, it will add all of the values in the list together.
One really important thing to remember is that if you’re using Storage by Zapier, getting the items from the list wont remove them from the list - they will stay on there until you use an action to clear all of the values at a particular Storage key. If you’re looking to add items to a list and then remove them all regularly, you might be better off using Digest by Zapier. It is similar to Storage but is a bit simpler, it doesn’t allow for things like line items for example. If you’re using Digest, the process will be a little different but similar. Instead of adding the comma between the items when fetch the items, you add it as the items are going into the digest. For example, if you add the number 45
to the Digest you type a comma afterwards the number so it becomes 45,
. That way, when you get the Digest (which will clear all values from it) your output will be each number followed by a comma.
I hope that answers your question - let us know if you need any other help!
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.