Help summing values until next blank row or value change

JumboCactuar

Well-known Member
Joined
Nov 16, 2016
Messages
785
Office Version
  1. 365
Platform
  1. Windows
Hi,
a bit stumpted on this one and not sure how to go about this:

see image below, the values in red are what i want to calculate:
ba553a1cc1.png


I need to calculate total quantity for each order based on column D.
In image above, values B2:B4 belong to customer JTS so are summed.
sum until next blank cell in column D or different value.

Appreciate any help
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Hi,

If you're willing to use a Helper Column (that you can hide, if you wish), you can do this:


Book1
ABCDE
1QTYTOTALCUSTOMERHelper
2A116aaaa
3B12aa
4C3aa
5aa
6D22bbbb
7bb
8E33cccc
9F22dddd
10G1724eeee
11H3ee
12I2ee
13J2ee
14ee
15K57ffff
16L1ff
17M1ff
Sheet282
Cell Formulas
RangeFormula
C2=IF(COUNTIF(E$2:E2,E2)=1,SUMIF(E$2:E$17,E2,B$2:B$17),"")
E2=IF(D2<>"",D2,E1)


Formulas copied down.
 
Upvote 0
Hi,

If you're willing to use a Helper Column (that you can hide, if you wish), you can do this:


Book1
ABCDE
1QTYTOTALCUSTOMERHelper
2A116aaaa
3B12aa
4C3aa
5aa
6D22bbbb
7bb
8E33cccc
9F22dddd
10G1724eeee
11H3ee
12I2ee
13J2ee
14ee
15K57ffff
16L1ff
17M1ff
Sheet282
Cell Formulas
RangeFormula
C2=IF(COUNTIF(E$2:E2,E2)=1,SUMIF(E$2:E$17,E2,B$2:B$17),"")
E2=IF(D2<>"",D2,E1)


Formulas copied down.

Hi,
It's been a while but I found a problem with this formula

From your example, if Customer aa is listed again further down the column (example D18)

It's values are adding to the total in C2 which is wrong
 
Upvote 0
You didn't mention that there would be "Repeated" customers in Column D further down, amend Column E formula as follows, Column C formula remains the same, change/adjust cell references/range as needed:


Book1
ABCDE
1QTYTOTALCUSTOMERHelper
2A116aaaa1
3B12aa1
4C3aa1
5aa1
6D22bbbb1
7bb1
8E33cccc1
9F22dddd1
10G1724eeee1
11H3ee1
12I2ee1
13J2ee1
14ee1
15K57ffff1
16L1ff1
17M1ff1
18ff1
191060aaaa2
2020aa2
2130aa2
22aa2
231575bbbb2
2425bb2
2535bb2
26bb2
27824aaaa3
2816aa3
Sheet282
Cell Formulas
RangeFormula
C2=IF(COUNTIF(E$2:E2,E2)=1,SUMIF(E$2:E$28,E2,B$2:B$28),"")
E2=IF(D2<>"",D2&COUNTIF(D$2:D2,D2),E1)
 
Upvote 0
You're welcome, thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,730
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