Not sure what type of Excel formula (SUM, SUMIF ect…) to use for my calculation, can you get me going in the right direction? [closed]

StackOverflow https://stackoverflow.com/questions/8989332

  •  13-11-2019
  •  | 
  •  

Question

In Excel Formulas there are so many different functions, that I am not sure which to use to get started. So if I were to give you an example could you point me in the right direction for learning what I need to do?

Ok so say you want 6 Apples (D3) And you want 3 oranges (D4) (also buying 1-7 apples gets you 1 orange free so they only need to pay for 2 oranges but if they buy 8-14 they get 2 oranges free and if they buy 15-21 they would get 3 oranges free and so on and so on. multiples of 7 apples get you a free orange) And 5 grapes (D5) (these are sold by the 3, so no matter if you buy 5 you get charged 2 because these are only sold in 3's) And 4 Bananas (D6) (sold by the each)

So is there a way to formulate this and make it all be one price in I3? The prices are D3=E11, D4=E12, D5=E13 and D6=E14 but for some reason it will not pick anything up past D4=E12, the code stops changing colors when I am putting in the formula.

Not sure if this makes any sense so any help you can give would be greatly appreciated!

Was it helpful?

Solution

If I'm understanding the rules right, I think your formula should be:

=D3*E11  +  MAX(0,D4-ROUNDUP(D3/7,0))*E12  +  ROUNDUP(D5/3,0)*E13  +  D6*E14

I've separated the blocks of calculations to make it easier to read.

I did assume the price you give for grapes (in E13) is for each set of 3 grapes.

(Edited - I just re-read your question - 1 apple gets 1 free orange, 8 apples gets 2 free oranges).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top