Help with a Shortcuts Calculation

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%.

7.46 x 49.46%= 3.69; 7.46-3.69= 3.77

Price x Margin = Profit; Price - Profit = Cost

Something like this?

https://www.icloud.com/shortcuts/2f9be6b73cec49ec914d98c2d7dabaf2

Also, working on the assumption that you might be a fellow accountant? :wink:

Actually, I’m in outside sales, but we set our margins and get a percentage of net profit. Also, that is perfect. How can I sent a coffee your way?

No need; only took me a second! Glad to be helpful! :blush:

2 Likes

Thanks so much! I took that Shortcut, and made it so I could figure out the price, with the desired profit margin.

1 Like

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.

If I understand the intent and details of the shortcut correctly…

You are asking for:

  1. A current selling price.
  2. A current profit margin (% not amount).
  3. A desired profit margin (%).

Then you are calculating the current profit

current profit = current profit margin x current selling price

Then from that you calculate the current wholesale cost.

wholesale cost = current list price - current profit

Then from that you are calculating what you should sell at to make the desired profit.

desired profit amount = wholesale cost x desired profit margin

revised selling price = wholesale cost + desired profit amount

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.

Hope that helps.

1 Like

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%

Calculation:
Cost: $5

Ask for input:
Desired margin: 10%

Returned information:

Cost is $5
New selling price is $5.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.

Do you see any other issue?

1 Like

Well, that can only mean one thing, because it looked right to me as well—our company’s calculations on what we are paid on are incorrect.

Is there a way to change the decimal?

I expect so … if you can explain what you mean. One of the decimals you are entering at run time.

1 Like

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.

1 Like

Thank you sooo much.

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. :slight_smile:

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.)

Hopefully that helps!

1 Like

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. :blush:

1 Like

Glad I could help! Let us know if we can help with the shortcut itself. :slight_smile:

1 Like

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.