For my job, I’m trying to create two shortcuts, and I’ve tried for hours and can’t figure it out. If anyone could help with either, I’d be truly appreciative. May even throw a coffee your way (if it works, of course). If I can figure this one out, I think I can make the other work for sure.

First, I’m trying to find out the cost of goods. So in this example it cost my company $7.46, and the profit margin is 49.46%.

So, I’m having a little trouble trying to create a shortcut based off of this one. I’m wanting to use the cost from this, and move it into another sbortcut that I can then set my price based off the margin I pick. Here is what I have, and the results are not accurate.

That’s how it reads to me, and so it makes sense to me if that’s what you are trying to achieve.

Can you share an example set of input values and the output you get along with the output you would expect to get at each of the calculation stages outlined above?

Alternately if the above isn’t what you were trying to achieve, can you provide some details around what you were trying to achieve?

As an aside, I’d recommend sticking to a common set of terminology/naming conventions between your question in the input capture (Ask for Input), your variable names (I’d try and name all the parts too for a set of multiple calculations | variables & magic variables), and your output naming in the results (Show Result). It helps when trying to keep track of what is used where.

Yes, thank you so much for your time and willingness to assist. So, for example, on my company’s website, I can see the selling price ($10.00) and the profit margin (50%). So, I need the shortcut to first calculate the cost in currency, not percentage. Then, I need the shortcut to take the cost in currency, ask for my input on what I’d like the margin to be, and then calculate the selling price.

Ask for input:
Current selling price: $10
Current margin: 50%

Okay, well the calculations you had look right. It is just the use of “%” in the Show Results action that looks wrong to me as it is a decimal representation.

We have an item listed for $35.35 at 51.06%. If I wanted to sell the item at 10% profit, the price would be $19.03. However, when I sell it $19.03 our sales margin shows 9.09%

I’m not in sales or accounting, so I’m afraid I’m unsure of the difference between a sales margin and a profit margin. However, if I plug in your numbers to your shortcut I get the following.

Which if I then break out into Calca and use the definitions I laid out above we can see the values at each stage in the calculations and unsurprisingly matches to the calculations that the shortcut is carrying out.

Now 9.09 sounds suspiciously like a rounding error against the 10% to me. I don’t see it appearing in the shortcut, so I’m currently thinking that you are miscalculating in your validation and introducing a rounding error there.

i.e. if you are selling at $19.03 and not accounting for the additional fractions beyond those first two decimal places, when you round off your margin you’re actually rounding in an error based on the source figures you were using.

If you want to incorporate any rough rounding into the calculations, there is an option to round figures in Shortcuts; just be acutely that rounding anywhere prior to the final calculation leads to greater errors.

Think about it like working with a compass heading. deviate by one degree on the final step of a 100 mile journey and you’ll reach your destination. Deviate by one degree on the first step and you’ll end up a long way from your destination.

Just jumping in (since I actually do happen to be an accountant!) to say that this is actually not a rounding error but an accounting one.

It comes down to the difference between a mark-up percentage and a margin percentage.
The first is calculated as (price - COGS)/COGS and the second as (price - COGS)/price.

For example, if you have something with a cost of $100, and you have a mark-up percentage of 10%, the price will be $110.
But, if you have a profit margin percentage of 10%, the price will be $111.11. (Because $111.11 x 10% = $11.11 and $11.11/$111.11 is 10%).

Basically, I believe your first shortcut is using the margin percentage but then you’re treating it like a mark-up percentage in the second shortcut. (I should note I didn’t actually look at your shortcuts but just basing this off the discussion here.)

To calculate the price with the same profit margin percentage, you need to change the second shortcut to use the formula: price = cost / (100% - profit margin percentage)

For your example that would give you price = $17.3003 / (1 - 0.1) = $17.3003 / 0.9 = $19.22

Testing that this is a 10% profit margin: $19.22 * 10% = $1.92 and $1.92/$19.22 = 10%. (Or at least 9.999% which is still a slight rounding error but just due to the necessity of using cents.)

Kaitlin, you’re a life saver. I spent an entire afternoon trying to figure out what the heck was going on. Now, to spend the evening figuring out how to change the Shortcut.

Any idea if I can actually do the formula exactly like that in Shortcuts? Not only am I not an accountant, I am only about halfway through David’s Shortcuts Field Guide. I am looking but not sure what to pick.