# Need help with a formula that subtracts a new value from an old value

I’ve created a table with an inventory of yarn colors and their weights (I’m a rug maker).
The goal is to create a formula which returns a number that calculates how much yarn of a certain color I used in the last project. After each project, I update the weight in the column that stores the weight in grams. Example:

(Before project): Lavender - 202g - Project Name
(After project): Lavender - 10g - Project Name

Amount Used:
202 - 10 = 192g

I don’t want to have to do the subtraction manually each time. I can’t figure out how to accomplish this or if there’s simply a better way at going about this. Let me know. Thank you!

hi @Jake_Chustz , welcome to the community. What you need and ask for is good to do with coda. it requires the set up of a few tables like colors, projects, materials and one that relates the products and their volumes to a project.

i wrote about this earlier this year: How To Coda your stock?. Keeping track of your inventory in 4… | by Christiaan Huizer | Medium

in case you have additional questions, feel free to reach out. Somebody else will take over and maybe even put together a doc for you that does the work @Quentin_Morel ?

Enjoy, Christiaan

3 Likes

Ahah, Report for Duty
Let me check that tonight

1 Like

A very brief introduction to @Christiaan_Huizer tutorial. That’s the first step, I invite you to read Christiaan blog and to complete the doc according to your need.

You have a master stock table, with the current weight. When you order or make inventory, you can update this manually.

Then You have a “project template”. This template uses Yarn lookup in each row, so that you can choose wich yarn you want. Lookup references give you the current weight available. It allows you to choose what weight you’ll consume through a slider (with maximum equals to current weight so that you want spend more than you possess). You also have a final weight as Current minus Project Consumption.

When you’re done using a yarn, you’ll press the “task finished” button that will modify the good yarn color “current weight” in your master table to the “final weight”. I also modify the value of “project consumption” to blank to well show that the use of this color is finished, using `RunActions()`

Here the quick doc, please play around with that ! As suggested in Christiaan blog, you could set a master button that will activate each line of your project, using something like `ForEach(Project Template, Button)`

3 Likes

Wow. @Christiaan_Huizer and @Quentin_Morel, thank you so much. I sometimes have a hard time asking for help and you’ve both made my life so much easier. I’ve only been using Coda consistently for about 2 months and it’s already helped get my life together. I have ADHD so keeping track of things can be hard for me. I played around with the doc and got it doin exactly what I needed. Thank you so much!!

2 Likes

Very happy that works, especially if coda could improve your day-to-day life ! Do not hesitate to post on the community, there will always be someone ready to give a shot on your coda issues

1 Like

Hi, do check out this template i created for small businesses. It also has an inventory page and automatically tracks all sales and purchases so you have an up-to-date inventory. You can copy it to use if you like it!

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.