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

I've a 1000 number entries (i.e n = 1000). I want to sum then in tens, that
is, 1-10, 2-11, 3-12,...990-1000). I want to do this using excel macro.
Please will somebody write the code for me?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default writing macro

In you first output cell enter

=SUMPRODUCT(--(ROW($A$1:$A$1000)(ROW(A1)-1)*10),--(ROW($A$1:$A$1000)<=ROW(A
1)*10),$A$1:$A$1000)

and copy down until you run out

--

HTH

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


"EFFY" wrote in message
...
I've a 1000 number entries (i.e n = 1000). I want to sum then in tens,

that
is, 1-10, 2-11, 3-12,...990-1000). I want to do this using excel macro.
Please will somebody write the code for me?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default writing macro

that
is, 1-10, 2-11, 3-12,...990-1000).


That does
1 - 10
11 - 20

not
1 - 10
2 - 11
3 - 12



=sum(A1:A10)

and copy down.
would be the formula solution, although the OP asked for a macro.

--
Regards,
Tom Ogilvy

"Bob Phillips" wrote in message
...
In you first output cell enter


=SUMPRODUCT(--(ROW($A$1:$A$1000)(ROW(A1)-1)*10),--(ROW($A$1:$A$1000)<=ROW(A
1)*10),$A$1:$A$1000)

and copy down until you run out

--

HTH

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


"EFFY" wrote in message
...
I've a 1000 number entries (i.e n = 1000). I want to sum then in tens,

that
is, 1-10, 2-11, 3-12,...990-1000). I want to do this using excel macro.
Please will somebody write the code for me?





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default writing macro

Assume you values are in A1:A1000 then

Sub SumByTen()
Dim i As Long, j As Long
j = 10
For i = 1 To 991
Cells(j, 2).Value = Application.Sum(Cells(i, 1).Resize(10))
Cells(j, 3).Value = "'" & i & " - " & i + 9
j = j + 1
Next
End Sub


The last sum would be 991 to 1000, not 990 to 1000

--
Regards,
Tom Ogilvy

"EFFY" wrote in message
...
I've a 1000 number entries (i.e n = 1000). I want to sum then in tens,

that
is, 1-10, 2-11, 3-12,...990-1000). I want to do this using excel macro.
Please will somebody write the code for me?



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
writing macro CN New Users to Excel 2 August 2nd 05 06:16 PM
Macro Writing rjamison Excel Programming 0 June 14th 05 12:14 AM
Macro Writing DFIChris Excel Programming 4 April 20th 05 04:51 PM
Macro Writing Help? Richard[_22_] Excel Programming 2 December 31st 03 07:39 PM
Writing Macro Tammy Klein Excel Programming 1 October 3rd 03 09:13 PM


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