Help with a Shortcuts Calculation

Why not have a go and see how far you get? It is just a case of using the same calculate action and the variables to calculate with. Halfway through the field guide should be more than enough understanding. Seriously, try it. I suspect you may surprise yourself :sunglasses:

No, I’m not one of those that doesn’t try. I’ll spend countless hours looking. What I can’t seem to find is how to use “( )” in a calculation. So I just need to do that calculation first in the shortcut? Math is my absolute worst subject, so there is my biggest struggle.

Yes, spot on. Just break it down into smaller calculations. Hopefully one day we’ll get a more powerful calculation action in Shortcuts. There are ways to do it that go out to other apps or employ JavaScript, but for this sort of calculation, breaking it down into steps is the way to go.

1 Like

Sounds like you’ve figured it out. I actually did have this drafted up already this morning when my internet unexpectedly died—so you may as well have it if not: https://www.icloud.com/shortcuts/bc43f14e79d14f92b488aa5f9ffba032

1 Like

I haven’t had the chance to work on it yet. However, I downloaded yours and tried it. When using your Shortcut, when the cost is $50, and you want the margin at 50%, the price comes back $100. It should be $75, correct? I’m trying to see where the calculation is coming from in the shortcut.

If you want a mark-up of 50%, it should be $75, but if you want a profit margin of 50% it should be $100. :slight_smile: This trips accounting students up all the time, haha. I’m not totally clear on which you are after but your original post suggests it is the margin you are looking at.

The shortcut basically does as follows:

  1. Calculate 1 - Margin
  2. Get the cost and divide it by the figure from 1
  3. Rounds to 2 decimal places
    Then the rounded figure is shown as the price.

As an aside that may be helpful as you get more familiar with Shortcuts: if you want to see where a variable is coming from in Shortcuts you can tap on it and then tap on “Reveal Action” and it will show you which part of the shortcut it is coming from.

Consider me a confused accounting student lol. I understood where the variables are coming from, but my lack of accounting knowledge made it hard to understand. Again, just want to let you know how thankful I am for your help, and that you’re awesome!

1 Like

Kaitlin,

I want to have the margin percentage determined by a drop down menu.
Is there a way I can get this to automatically filter rather than having a person pick the % every time?

Hi @Chris_Bolte! So sorry, I’ve been MIA and missed your message.

When you say “automatically filter rather than having a person pick the % every time” I’m not 100% sure of what you mean, but as far as selecting from a dropdown it’s fairly straightforward: instead of asking for a number, you would add a list of the options you wanted the user to select and then add a “choose from list action”

I’ve tweaked the shortcut to do this (and take advantage of some of the changes in Shortcuts math made since the original): https://www.icloud.com/shortcuts/d0ec4e1a4686403dbef9f0863898682a

Let me know if that’s not what you were looking to do!

(Of course you might have sorted this out in the meantime but thought I would respond anyway in case this helps anyone else who might stumble across this. :slight_smile: )