Search code examples
google-sheetsgoogle-sheets-formulaformula

Calculating a conditional sum in Google Sheets


Google Sheet with Formula I've created a Google Sheet which has 3 product prices based on quantity ordered (1 x jar (A3), 2 x jars (B3), 3+ jars (C3) and I'm struggling to create a formula which will calculate the price based on the quantity entered in the "D" column.

I tried a multiple "IF" statement like = IF(D8 = 1, SUM(D8*A3), IF(D8 = 2, SUM(D8*B3), IF(D8 >= 3, SUM(D8*C3)))), but it doesn't work. I'm thinking that maybe I need an "ARRAYFORMULA", but I can't find any examples for inspiration.

Any advice would be appreciated.


Solution

  • Assuming that your sheet would look like this since no data was provided about the Google Sheet.

    Click here

    You may use the following formula to accomplish what you'd like based on the IF statement that you have provided:

    SHEET FORMULA

    =IF(D8<2, D8*A3, IF(D8<3, D8*B3, D8*C3))
    

    OUTPUT

    Click here

    REFERENCE