Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,173
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Summary Eliz Excel Worksheet Functions 2 March 10th 10 03:04 AM
Summary tofimoon3[_7_] New Users to Excel 1 June 5th 09 05:02 AM
Summary help! ml Excel Worksheet Functions 3 July 24th 08 07:12 PM
multi group with summary above with 1 overall summary line below Freddy Excel Discussion (Misc queries) 2 November 7th 05 03:30 PM
multi group with summary above with 1 overall summary line below Freddy Excel Discussion (Misc queries) 1 November 1st 05 08:50 PM


All times are GMT +1. The time now is 08:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"