Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Summary problem
Good Day Group, I am stuck with this problem that might be easier then I think(?). Grateful for any help. Have data in columns A and B as below. Looking for to put values in column C as shown, that is the sum of the values in B when the values in A are the same. Brgds CG Rosén ???? A B C 040702 20 040702 10 040702 20 50 040703 20 040703 10 30 040704 10 040704 5 040704 20 040704 10 040704 5 040704 10 60 040710 25 25 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Summary problem
If you truly need a programming option then the code below will work
providing the data in column A is contiguous Sub sumSame() Dim rRange As Range Dim rCell As Range Dim x As Double Set rRange = Range("A1:" & Range("A65536").End(xlUp).Address) For Each rCell In rRange If rCell.Offset(1, 0).Value = rCell.Value Then x = rCell.Offset(0, 1).Value + x Else rCell.Offset(0, 2).Value = x + rCell.Offset(0, 1).Value x = 0 End If Next rCell End Sub An alternative maybe to check out datasubtotals... -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England HIS "CG Rosén" wrote in message ... Good Day Group, I am stuck with this problem that might be easier then I think(?). Grateful for any help. Have data in columns A and B as below. Looking for to put values in column C as shown, that is the sum of the values in B when the values in A are the same. Brgds CG Rosén ???? A B C 040702 20 040702 10 040702 20 50 040703 20 040703 10 30 040704 10 040704 5 040704 20 040704 10 040704 5 040704 10 60 040710 25 25 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Summary | Excel Worksheet Functions | |||
Summary | New Users to Excel | |||
Summary help! | Excel Worksheet Functions | |||
multi group with summary above with 1 overall summary line below | Excel Discussion (Misc queries) | |||
multi group with summary above with 1 overall summary line below | Excel Discussion (Misc queries) |