Hello all,
I have an excel file with 1000s of lines of products and cost details for them as well. Given below is a sample data:
And what you see below has two added columns where I need help with the formula:
As you can see, the requirement "looks" pretty simple. If in column A, the type of pricing is YearLong, the calculation is to be done in column G (Regular discount), and the value should come as B2 - C2, which is $20 in this case and it runs from week 1 to week 24 of the year. From week 25, this pricing gets updated and we will be giving B4-C4, $40 - $22, $18 Regular discount.
The issue comes in row 3 when I have to calculate the extra discount. Whenever there is a type of pricing "Special" in column A, the calculation has to happen in column H (Extra discount). Since, the "start week" of the special discount is week 21, you can understand that from weeks 21 through 24 the extra discount should be - the YearLong invoice cost for these weeks (column C) minus the Invoice Cost for the Special price in these weeks, i.e. $20 - $18 = $2 should be coming for those weeks, and from weeks 25 onwards when the invoice cost for YearLong discount increases to $22, the special discount from weeks 25 - 53 will be $22 - $18 = $4. Hence, the final value in the Extra Discount column for this product should be the weighted average of these two blended pricing.
Looks simple if there are only 3 rows an only 1 product, but there are 1000s of lines like I said and manually doing this is a pain in the behind. I am open to formulas as well as macro solutions for this calcualtion. It will be a life saver if any of you can help out. Thank you.
I have an excel file with 1000s of lines of products and cost details for them as well. Given below is a sample data:
And what you see below has two added columns where I need help with the formula:
As you can see, the requirement "looks" pretty simple. If in column A, the type of pricing is YearLong, the calculation is to be done in column G (Regular discount), and the value should come as B2 - C2, which is $20 in this case and it runs from week 1 to week 24 of the year. From week 25, this pricing gets updated and we will be giving B4-C4, $40 - $22, $18 Regular discount.
The issue comes in row 3 when I have to calculate the extra discount. Whenever there is a type of pricing "Special" in column A, the calculation has to happen in column H (Extra discount). Since, the "start week" of the special discount is week 21, you can understand that from weeks 21 through 24 the extra discount should be - the YearLong invoice cost for these weeks (column C) minus the Invoice Cost for the Special price in these weeks, i.e. $20 - $18 = $2 should be coming for those weeks, and from weeks 25 onwards when the invoice cost for YearLong discount increases to $22, the special discount from weeks 25 - 53 will be $22 - $18 = $4. Hence, the final value in the Extra Discount column for this product should be the weighted average of these two blended pricing.
Looks simple if there are only 3 rows an only 1 product, but there are 1000s of lines like I said and manually doing this is a pain in the behind. I am open to formulas as well as macro solutions for this calcualtion. It will be a life saver if any of you can help out. Thank you.