Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Group and SUM

Hi
There is no need for a macro to achieve this.
In sheet2:
place in column A the # S numbers
formula in column B : =SUMIF(Sheet1!A1:A10,A1,Feuil1!B1:B10)
Drag down formula in column B.

HTH
Cordially
Pascal

"Ananth" a écrit dans le message de news:
...
Macro Help

I have in Sheet1 INPUT as under

INPUT
Col-A Col-B

S1 1
S2 1
S3 1
S4 1
S5 1
S1 2
S2 3
S3 4
S4 5
S5 6

I want to use Macro and produce an output in Sheet2 as under. Essentially
I
want to group Col-A and see a summation in Col-C

Any help will be greatly appreciated by this Macro Novice.

OUTPUT

Col-A Col-B Col-C Col-D
S1 1 2 3
S2 1 3 4
S3 1 4 5
S4 1 5 6
S5 1 6 7



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default Group and SUM

I am aware of this solution. I am learing Macro and wanted to apply to a
relatime application.

I am handling a worksheet that has 40000 Rows & 150 Columns of information.
I want to cull out data from this master worksheet from certain fields. hence
I sought forum help.
"papou" wrote:

Hi
There is no need for a macro to achieve this.
In sheet2:
place in column A the # S numbers
formula in column B : =SUMIF(Sheet1!A1:A10,A1,Feuil1!B1:B10)
Drag down formula in column B.

HTH
Cordially
Pascal

"Ananth" a écrit dans le message de news:
...
Macro Help

I have in Sheet1 INPUT as under

INPUT
Col-A Col-B

S1 1
S2 1
S3 1
S4 1
S5 1
S1 2
S2 3
S3 4
S4 5
S5 6

I want to use Macro and produce an output in Sheet2 as under. Essentially
I
want to group Col-A and see a summation in Col-C

Any help will be greatly appreciated by this Macro Novice.

OUTPUT

Col-A Col-B Col-C Col-D
S1 1 2 3
S2 1 3 4
S3 1 4 5
S4 1 5 6
S5 1 6 7




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Group and SUM

Ok then have a look at this :
Dim LastRowSh1 As Integer, i As Integer
LastRowSh1 = Sheets("Sheet1").Range("A65536").End(xlUp).Row
Sheets("Sheet1").Range("A1:A" & LastRowSh1).AdvancedFilter
Action:=xlFilterCopy, _
CopyToRange:=Sheets("Sheet2").Range("A1"), Unique:=True

Dim MyFormula As String


With Worksheets("Sheet2")
For i = 2 To .Range("A65536").End(xlUp).Row
MyFormula = "=SUMIF(Sheet1!A1:A" & LastRowSh1 & ",A" & i & ",Sheet1!B2:B" &
LastRowSh1 & ")"
..Cells(i, 2).Value = Evaluate(MyFormula)
Next i
End With

HTH
Cordially
Pascal

"Ananth" a écrit dans le message de news:
...
I am aware of this solution. I am learing Macro and wanted to apply to a
relatime application.

I am handling a worksheet that has 40000 Rows & 150 Columns of
information.
I want to cull out data from this master worksheet from certain fields.
hence
I sought forum help.
"papou" wrote:

Hi
There is no need for a macro to achieve this.
In sheet2:
place in column A the # S numbers
formula in column B : =SUMIF(Sheet1!A1:A10,A1,Feuil1!B1:B10)
Drag down formula in column B.

HTH
Cordially
Pascal

"Ananth" a écrit dans le message de
news:
...
Macro Help

I have in Sheet1 INPUT as under

INPUT
Col-A Col-B

S1 1
S2 1
S3 1
S4 1
S5 1
S1 2
S2 3
S3 4
S4 5
S5 6

I want to use Macro and produce an output in Sheet2 as under.
Essentially
I
want to group Col-A and see a summation in Col-C

Any help will be greatly appreciated by this Macro Novice.

OUTPUT

Col-A Col-B Col-C Col-D
S1 1 2 3
S2 1 3 4
S3 1 4 5
S4 1 5 6
S5 1 6 7






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Group and SUM

Oops, sorry forgot to mention:
Provided column headers present in sheet1 on first row before data.

Cordially
Pascal

"papou" a écrit dans le message de news:
...
Ok then have a look at this :
Dim LastRowSh1 As Integer, i As Integer
LastRowSh1 = Sheets("Sheet1").Range("A65536").End(xlUp).Row
Sheets("Sheet1").Range("A1:A" & LastRowSh1).AdvancedFilter
Action:=xlFilterCopy, _
CopyToRange:=Sheets("Sheet2").Range("A1"), Unique:=True

Dim MyFormula As String


With Worksheets("Sheet2")
For i = 2 To .Range("A65536").End(xlUp).Row
MyFormula = "=SUMIF(Sheet1!A1:A" & LastRowSh1 & ",A" & i & ",Sheet1!B2:B"
& LastRowSh1 & ")"
.Cells(i, 2).Value = Evaluate(MyFormula)
Next i
End With

HTH
Cordially
Pascal

"Ananth" a écrit dans le message de
news:
...
I am aware of this solution. I am learing Macro and wanted to apply to a
relatime application.

I am handling a worksheet that has 40000 Rows & 150 Columns of
information.
I want to cull out data from this master worksheet from certain fields.
hence
I sought forum help.
"papou" wrote:

Hi
There is no need for a macro to achieve this.
In sheet2:
place in column A the # S numbers
formula in column B : =SUMIF(Sheet1!A1:A10,A1,Feuil1!B1:B10)
Drag down formula in column B.

HTH
Cordially
Pascal

"Ananth" a écrit dans le message de
news:
...
Macro Help

I have in Sheet1 INPUT as under

INPUT
Col-A Col-B

S1 1
S2 1
S3 1
S4 1
S5 1
S1 2
S2 3
S3 4
S4 5
S5 6

I want to use Macro and produce an output in Sheet2 as under.
Essentially
I
want to group Col-A and see a summation in Col-C

Any help will be greatly appreciated by this Macro Novice.

OUTPUT

Col-A Col-B Col-C Col-D
S1 1 2 3
S2 1 3 4
S3 1 4 5
S4 1 5 6
S5 1 6 7








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
Copy Data from One Group of Cells to Another Group Alan Auerbach Charts and Charting in Excel 2 May 27th 07 04:12 PM
Group a range - closing the group does not hide the controls.... [email protected] Excel Programming 0 April 21st 07 04:53 AM
Sort by Group Header or by Group SubHeader Aria[_2_] Excel Programming 4 February 28th 07 01:07 AM
Taking age group Ie ages 20-29 and picking out net sales for group viabello Excel Worksheet Functions 1 April 25th 06 04:19 AM
How do I group worksheets (Lotus 123 function is "Sheet>Group Shee jaking Excel Worksheet Functions 2 August 30th 05 02:09 PM


All times are GMT +1. The time now is 10:22 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"