Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default group cells.......

Use subtotals (go to menu /data /subtotals)
RADO

"R-M" wrote in message
...
Hi

I've following information wanted to group by first
column and show the sum of quantities:


a b c
---- ----- ------
123 10.8
123 20.2
123 44
124 2
124 11
124 45


The desired result:

a b c
---- ----- ------
123 10.8 75 - sum(10.8+20.2+44)
123 20.2
123 44
124 2 58 - sum(2+11+45+0)
124 11
124 45
124 0


note: I don't want to write sum(a1:a3) , ... because
it depends on the number of rows has the same value.

any help would greatly appricieted.


--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/



  #2   Report Post  
Posted to microsoft.public.excel.programming
R-M R-M is offline
external usenet poster
 
Posts: 1
Default group cells.......

Hi

I've following information wanted to group by first
column and show the sum of quantities:


a b c
---- ----- ------
123 10.8
123 20.2
123 44
124 2
124 11
124 45


The desired result:

a b c
---- ----- ------
123 10.8 75 - sum(10.8+20.2+44)
123 20.2
123 44
124 2 58 - sum(2+11+45+0)
124 11
124 45
124 0


note: I don't want to write sum(a1:a3) , ... because
it depends on the number of rows has the same value.

any help would greatly appricieted.


--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default group cells.......

The following VBA code will do what you want

Sub STots()
Dim Rw 'Row being evaluated
Dim Var 'The value in column A
Dim Srw 'the 1st row containing VAR
Dim Stot 'sub-total of values in column B
Rw = 1: Srw = 1
Var = Cells(Rw, 1)
Do
Do
Stot = Stot + Cells(Rw, 2)
Rw = Rw + 1
Loop While Cells(Rw, 1) = Var
Cells(Srw, 3) = Stot
Stot = 0: Srw = Rw: Var = Cells(Rw, 1)
Loop Until Cells(Rw, 1) = ""
End Sub

The above assumes that your data list starts in cell A1.
If not, adjust as necessary.

regards,
Don
--

"R-M" wrote in message
...
Hi

I've following information wanted to group by first
column and show the sum of quantities:


a b c
---- ----- ------
123 10.8
123 20.2
123 44
124 2
124 11
124 45


The desired result:

a b c
---- ----- ------
123 10.8 75 - sum(10.8+20.2+44)
123 20.2
123 44
124 2 58 - sum(2+11+45+0)
124 11
124 45
124 0


note: I don't want to write sum(a1:a3) , ... because
it depends on the number of rows has the same value.

any help would greatly appricieted.


--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default group cells.......

If your data starts in row 1, then the formula for C1 would be:
=SUMIF(A:A,"="&A1,B:B)

Then in subsequent rows, use:
=IF(A2=A1,"",SUMIF(A:A,"="&A2,B:B))

--
Dianne

In ,
R-M typed:

I've following information wanted to group by first
column and show the sum of quantities:

a b c
---- ----- ------
123 10.8 75 - sum(10.8+20.2+44)
123 20.2
123 44
124 2 58 - sum(2+11+45+0)
124 11
124 45
124 0



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default group cells.......

I should have said:

In row 2 enter
=IF(A2=A1,"",SUMIF(A:A,"="&A2,B:B))

and copy it down.

--
Dianne

In ,
Dianne typed:
If your data starts in row 1, then the formula for C1 would be:
=SUMIF(A:A,"="&A1,B:B)

Then in subsequent rows, use:
=IF(A2=A1,"",SUMIF(A:A,"="&A2,B:B))


I've following information wanted to group by first
column and show the sum of quantities:

a b c
---- ----- ------
123 10.8 75 - sum(10.8+20.2+44)
123 20.2
123 44
124 2 58 - sum(2+11+45+0)
124 11
124 45
124 0



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
Can you name a group of cells? Amy Excel Discussion (Misc queries) 3 February 25th 10 09:19 PM
Match a group of cells with another group of cells Rod in Oz Excel Worksheet Functions 1 October 9th 08 01:45 AM
Copy Data from One Group of Cells to Another Group Alan Auerbach Charts and Charting in Excel 2 May 27th 07 04:12 PM
from a group of cells.find average of cells containing values farm Excel Discussion (Misc queries) 1 December 21st 06 08:50 PM
copy group of cells to another group of cells using "IF" in third Chuckak Excel Worksheet Functions 2 November 10th 04 06:04 PM


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