Forum Discussion

Simon55's avatar
Simon55
Copper Contributor
Dec 08, 2025

Excel cell calculation

Hi all, first timer here.

In Mac Excel I’m wanting to calculate a selling price minus a cost price times the amount of items.

So cell D4 is $3, minus cell C4 which is $1, multiplied by 18 items B4.

In E4 I have done the formula of =D4-C4*B4 but I get -$15 which is incorrect, should be $36

Where am I going wrong?

 

Thanks all

3 Replies

  • OlufemiO's avatar
    OlufemiO
    Brass Contributor

    HiSimon55​ 

    welcome!

    The issue is with the way Excel handles the order of operations. Multiplication happens before subtraction, so your formula:

    =D4-C4*B4


    is being calculated as:

    = D4 - (C4 * B4)
    = 3 - (1 * 18)
    = -15


    What you actually want is the difference between selling price and cost price, multiplied by the number of items. To make sure Excel does that, add parentheses:

    =(D4 - C4) * B4


    That gives:

    = (3 - 1) * 18
    = 36


    So the fix is simply to use parentheses to control the calculation order.

  • SnowMan55's avatar
    SnowMan55
    Bronze Contributor

    Excel evaluates mathematical expressions according to the PEMDAS rule, which you may have heard of: (first) evaluate what is inside Parentheses; next evaluate Exponentiation; next evaluate Multiplication and Division (left-to-right); next evaluate Addition and Subtraction (also left-to-right).  But Excel has a few more operators, so see this Microsoft documentation, specifically, the Operator Precedence section.

Resources