• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to find continuous way to sum a product using If with and syntax

Don Black

New Member
I want expand this code that if the qty (2,3,4,......) changes I want -subtract 25, 50, 75 .......

This works great, but I want it to subtract from SUM(($D2*$B2) by increments of 25 when qty changes in $D2 = qty column
Code:
=IF(AND($C2="Item 1",$E$1="Item 1",$D2>=2),SUM(($D2*$B2)-25),"")


Please excuse If I am not making this clear enough I am a noob.....
 

Attachments

  • Test Document.xlsx
    13.8 KB · Views: 8
Formula in E2:
=IF(AND($C2=E$1,$D2>=2),$B2*$D2-25*($D2-1),"")

Copy to the right and down as needed. No need for all those unique formulas. :)
 
Thank you for cleaning up my code. It works great,but the increments do not -subtract by (25) except for the first 2. I am subtracting by (25) for each qty 2=25, 3=50, 4=75, 5=100.
 
So, if qty =2, subtract 25
if qty = 3, subtract 50
if qty = 4, subtract 75
etc.

Is that correct? If so, formula is working correctly...
upload_2014-9-17_13-57-24.png
350 * 3= 1050. Subtract 50 since qty = 3, and result is 1000.
 
Ok, I see what your saying I apologize, I need the formula sum the qty based on Qty = (1+2+3) Price=(350+325+300) which would represent the qty of 3 totaling (975)
 
Ah. In that case, new formula:
=IF(AND($C2=E$1,$D2>=2),SUMPRODUCT($B2-25*(ROW($A$1:INDEX($A:$A,$D2))-1)),"")
 
Back
Top