Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Getting the sum of rows.


if i have a Data stored in Column A with A1 = Column Label, and data are
placed in A2:A100
now, i want to get the:
average of A1:A5 and store it in A105
average of A6:A10 and store it in A106
average of A11:A15 and store it in A107 and so on.

At first i tried to record this macro by doing the following:
I tried to assign A105 with "=average(A1:A5)" and A106 with"=A6:A10"
then i select A105:A106 and drag it down. However the result is not
what i expected as the A107 will have the value "=average(A2:A6) and
not average of A11:A15. Therefore, i cant record it.

So, how can i achieve this using a macro? Thanks


--
changeable
------------------------------------------------------------------------
changeable's Profile: http://www.excelforum.com/member.php...o&userid=15714
View this thread: http://www.excelforum.com/showthread...hreadid=275987

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Getting the sum of rows.

Here is some code

Dim i As Long

For i = 1 To 100 Step 5
Range("A" & 105 + i \ 5).Formula = "=SUM(A" & i & ":A" & i + 4 & ")"
Next i

--

HTH

RP
(remove nothere from the email address if mailing direct)


"changeable" wrote in message
...

if i have a Data stored in Column A with A1 = Column Label, and data are
placed in A2:A100
now, i want to get the:
average of A1:A5 and store it in A105
average of A6:A10 and store it in A106
average of A11:A15 and store it in A107 and so on.

At first i tried to record this macro by doing the following:
I tried to assign A105 with "=average(A1:A5)" and A106 with"=A6:A10"
then i select A105:A106 and drag it down. However the result is not
what i expected as the A107 will have the value "=average(A2:A6) and
not average of A11:A15. Therefore, i cant record it.

So, how can i achieve this using a macro? Thanks


--
changeable
------------------------------------------------------------------------
changeable's Profile:

http://www.excelforum.com/member.php...o&userid=15714
View this thread: http://www.excelforum.com/showthread...hreadid=275987



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default Getting the sum of rows.

Bob:
What does the "\" mean in your code -- is it sorta looks like an If Mod=0
thing?
TIA,
Jim

"Bob Phillips" wrote in message
...
Here is some code

Dim i As Long

For i = 1 To 100 Step 5
Range("A" & 105 + i \ 5).Formula = "=SUM(A" & i & ":A" & i + 4 &

")"
Next i

--

HTH

RP
(remove nothere from the email address if mailing direct)


"changeable" wrote in message
...

if i have a Data stored in Column A with A1 = Column Label, and data are
placed in A2:A100
now, i want to get the:
average of A1:A5 and store it in A105
average of A6:A10 and store it in A106
average of A11:A15 and store it in A107 and so on.

At first i tried to record this macro by doing the following:
I tried to assign A105 with "=average(A1:A5)" and A106 with"=A6:A10"
then i select A105:A106 and drag it down. However the result is not
what i expected as the A107 will have the value "=average(A2:A6) and
not average of A11:A15. Therefore, i cant record it.

So, how can i achieve this using a macro? Thanks


--
changeable
------------------------------------------------------------------------
changeable's Profile:

http://www.excelforum.com/member.php...o&userid=15714
View this thread:

http://www.excelforum.com/showthread...hreadid=275987





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default Getting the sum of rows.

Never mind Bob -- I found your previous answer to this (below from within
Google)...

Message 9 in thread
From: Bob Phillips )
Subject: Strange RGB Value

View this article only
Newsgroups: microsoft.public.excel.programming
Date: 2003-04-18 13:33:01 PST

Phobos,
FYI
r = Int(rgbValue / 65536)
can be better written as
r = rgbValue \65536
as \ is an integer division operator (saves typing<g)
Regards

Bob

"Jim May" wrote in message
news:27sjd.85273$UA.3714@lakeread08...
Bob:
What does the "\" mean in your code -- is it sorta looks like an If Mod=0
thing?
TIA,
Jim

"Bob Phillips" wrote in message
...
Here is some code

Dim i As Long

For i = 1 To 100 Step 5
Range("A" & 105 + i \ 5).Formula = "=SUM(A" & i & ":A" & i + 4 &

")"
Next i

--

HTH

RP
(remove nothere from the email address if mailing direct)


"changeable" wrote in message
...

if i have a Data stored in Column A with A1 = Column Label, and data

are
placed in A2:A100
now, i want to get the:
average of A1:A5 and store it in A105
average of A6:A10 and store it in A106
average of A11:A15 and store it in A107 and so on.

At first i tried to record this macro by doing the following:
I tried to assign A105 with "=average(A1:A5)" and A106 with"=A6:A10"
then i select A105:A106 and drag it down. However the result is not
what i expected as the A107 will have the value "=average(A2:A6) and
not average of A11:A15. Therefore, i cant record it.

So, how can i achieve this using a macro? Thanks


--
changeable


------------------------------------------------------------------------
changeable's Profile:

http://www.excelforum.com/member.php...o&userid=15714
View this thread:

http://www.excelforum.com/showthread...hreadid=275987







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
colating multi rows of data into single rows - no to pivot tables! UKMAN Excel Worksheet Functions 4 March 12th 10 04:11 PM
Auto extract data & inserts rows additional rows automatically Meeru Excel Discussion (Misc queries) 3 September 9th 09 01:46 PM
Enabling option „Format rows“ to hide/unhide rows using VBA-code? ran58 Excel Discussion (Misc queries) 0 July 28th 09 03:46 PM
Counting characters in multiple rows when rows meet specific criteria news.virginmedia.com Excel Worksheet Functions 3 June 28th 08 09:03 PM
Excel 2003 -Rows hidden. Scrolling unhides rows ! How do I stop th Excellent1975 Excel Discussion (Misc queries) 0 June 21st 06 08:01 PM


All times are GMT +1. The time now is 12:00 AM.

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

About Us

"It's about Microsoft Excel"