Sum Numbers up to Number in Top Column

RaMDT

New Member
Joined
Jun 3, 2019
Messages
6
Complicated but... here's the final product I need:

Bold = data I have
non-bold = data how I need it to show

Customer ACustomer B
20120
Product 11010
Product 21010
Product 38080
Product 41010
Product 51010
Product 61010
Product 71010

<tbody>
</tbody>

Customer A gets the data from column #2(B) up to 20 (10+10)
then because Customer A is done w/ 20, it goes to Customer B
Customer B gets the data from column #2(B) up to 120 (80+10+10+10+10)

A bit complicated to explain but I hope you get it. I'll happily answer any questions. I'm OK w/ VBA. Thank you!!!:)
 
Try this. In C4 then dragged across.

Code:
=IF(AND($B4>0,C$2>0),IF(AND(SUMIF($B$4:$B4,">0")>SUMIF($B$2:B$2,">0"),SUMIF($B$4:$B4,">0")<=SUMIF($B$2:C$2,">0")),$B4,""),IF(AND($B4<0,C$2<0),IF(AND(SUMIF($B$4:$B4,"<0")<SUMIF($B$2:B$2,"<0"),SUMIF($B$4:$B4,"<0")>=SUMIF($B$2:C$2,"<0")),$B4,""),""))

What about product 20 and 21. They will not have any value in Cust columns.
 
Upvote 0

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
I'm struggling to understand how to interpret and handle negative numbers. Perhaps I should only use numbers in the calculations that have the same sign? So customers A-E and G ignore the -10 in B22, and customer F ignores everything except B22? And in your example from post 8, shouldn't I23 be a valid result (black not red)?
 
Upvote 0
Try this. In C4 then dragged across.

Code:
=IF(AND($B4>0,C$2>0),IF(AND(SUMIF($B$4:$B4,">0")>SUMIF($B$2:B$2,">0"),SUMIF($B$4:$B4,">0")<=SUMIF($B$2:C$2,">0")),$B4,""),IF(AND($B4<0,C$2<0),IF(AND(SUMIF($B$4:$B4,"<0")<sumif($b$2:b$2,"<0"),sumif($b$4:$b4,"<0")>=SUMIF($B$2:C$2,"<0")),$B4,""),""))

What about product 20 and 21. They will not have any value in Cust columns.


This worked like a charm.

Thank you SO much, kvsrinivasamurthy & Eric W!!! </sumif($b$2:b$2,"<0"),sumif($b$4:$b4,"<0")>:biggrin:
 
Upvote 0

Forum statistics

Threads
1,214,648
Messages
6,120,726
Members
448,987
Latest member
marion_davis

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top