Hi
I am working on a tool that sumerizes weights of product packages. The material level formulas and calculation of weights are all done, but I need help with a formula that sumerizes these weights on product package level only.
Exampel
Large amount of data will be insterted into column A and weights will be automatically calculated in column B. Column C should then sumerize these weights based on if column A starts with letter or a dot. When underlying material exist it should sumerize this all the way down to next product package which always begins with letter and not a dot. Sometimes a product package have underlying material sometimes it does not. i.e the rows in green is where I would like to have these sumerizes.
The formula will be draged down maybe thousand rows so it cannot involve any manual editing. Does anyone have an idea how to help me with this?
Example can be seen in attached.
Thanks in advance for all your help!
BR Marcus
With a helper column, maybe?
See the attached updated example.
Regards
The below is far from ideal given it goes against "best practice" re: design of calcs (looking down rather than up)
D2: =IF(OR(LEFT($B2)=".";$B2="");"";SUM($C2:$C$15)-SUM($E3:$E$16)) copied down to D15
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
Spent some time on this one as the counters were throwing me off..
Anyways see below and let me know if you need any modifications. this places the summary in column D and at the start of the new cell with a letter...
Option Explicit Public Sub SumValues() Dim sumField As Double, cellValue As String, counter As Long, totalRows As Long, cellCount As Long counter = ActiveSheet.UsedRange.Rows.Count cellValue = Left(Cells(counter, 2), 1) sumField = Cells(counter, 3) While (counter >= 2) cellValue = Left(Cells(counter, 2), 1) If (cellValue = ".") Then cellCount = cellCount + 1 If (cellCount = 1) Then sumField = 0 sumField = sumField + Cells(counter, 3) Else sumField = sumField + Cells(counter, 3) End If Else If (cellCount >= 1) Then sumField = sumField + Cells(counter, 3) Cells(counter, 4) = sumField sumField = 0 Else sumField = Cells(counter, 3) Cells(counter, 4) = sumField sumField = 0 cellCount = 0 End If End If counter = counter - 1 Wend End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks