Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sum the first 10 numbers in a 26 cell range

I have to sum the first 10 numbers in a 26 cell range. The problem is
that I do not know which cells the numbers are in. The 26 cells
contain single quotes (') to begin with. The numbers are typed in as
the event occurs. I do not know which cells they will be typed in. I
only want the first 10 numbers to be sumed. This can be a formula or a
macro. The formula is preferred. Thanks in advance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 97
Default Sum the first 10 numbers in a 26 cell range



how about, assuming your 26 cells start in ell a5

put this in b5 and copy down
=IF(ISERROR(VALUE(A5))=TRUE,0,VALUE(A5))

put this in c5 and copy down
=COUNTIF(B5,"0")

put this in c5 and copy down
=IF(SUM($C$5:C5)<10,SUM($B$5:B5),D4)

your sum will be the max of column d

John
-----Original Message-----
I have to sum the first 10 numbers in a 26 cell range.

The problem is
that I do not know which cells the numbers are in. The 26

cells
contain single quotes (') to begin with. The numbers are

typed in as
the event occurs. I do not know which cells they will be

typed in. I
only want the first 10 numbers to be sumed. This can be a

formula or a
macro. The formula is preferred. Thanks in advance.
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,979
Default Sum the first 10 numbers in a 26 cell range

Assuming the 26 cells are A2:A27, enter the following formula in cell B2:

=IF(COUNT($A$1:A2)10,"",N(B1)+N(A2))

anc copy it down to B27

jester wrote:
I have to sum the first 10 numbers in a 26 cell range. The problem is
that I do not know which cells the numbers are in. The 26 cells
contain single quotes (') to begin with. The numbers are typed in as
the event occurs. I do not know which cells they will be typed in. I
only want the first 10 numbers to be sumed. This can be a formula or a
macro. The formula is preferred. Thanks in advance.



--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Sum the first 10 numbers in a 26 cell range

jester,

=SUM(OFFSET($A$2,0,0,SMALL(IF(ISBLANK(A2:A27),"",R OW(A2:A27)),G1)-1,1))
(G1 is = 10)
enter as array formula

"jester" wrote in message
om...
I have to sum the first 10 numbers in a 26 cell range. The problem is
that I do not know which cells the numbers are in. The 26 cells
contain single quotes (') to begin with. The numbers are typed in as
the event occurs. I do not know which cells they will be typed in. I
only want the first 10 numbers to be sumed. This can be a formula or a
macro. The formula is preferred. Thanks in advance.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Sum the first 10 numbers in a 26 cell range

Forgot they were text

try:

Function addtext(myrange, howmany)
For Each r In myrange
If r < "" Then
counter = counter + 1
total = total + Val(r)
addtext = total
If counter = 10 Then Exit Function
Else
End If
Next
End Function

Don

"Don" wrote in message
...
jester,

=SUM(OFFSET($A$2,0,0,SMALL(IF(ISBLANK(A2:A27),"",R OW(A2:A27)),G1)-1,1))
(G1 is = 10)
enter as array formula

"jester" wrote in message
om...
I have to sum the first 10 numbers in a 26 cell range. The problem is
that I do not know which cells the numbers are in. The 26 cells
contain single quotes (') to begin with. The numbers are typed in as
the event occurs. I do not know which cells they will be typed in. I
only want the first 10 numbers to be sumed. This can be a formula or a
macro. The formula is preferred. Thanks in advance.







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Sum the first 10 numbers in a 26 cell range

Sorry, Try again

Function addtext(myrange, howmany)
For Each r In myrange
If r < "" Then
counter = counter + 1
total = total + Val(r)
addtext = total
If counter = howmany Then Exit Function
Else
End If
Next
End Function

Don
"Don" wrote in message
...
jester,

=SUM(OFFSET($A$2,0,0,SMALL(IF(ISBLANK(A2:A27),"",R OW(A2:A27)),G1)-1,1))
(G1 is = 10)
enter as array formula

"jester" wrote in message
om...
I have to sum the first 10 numbers in a 26 cell range. The problem is
that I do not know which cells the numbers are in. The 26 cells
contain single quotes (') to begin with. The numbers are typed in as
the event occurs. I do not know which cells they will be typed in. I
only want the first 10 numbers to be sumed. This can be a formula or a
macro. The formula is preferred. Thanks in advance.





  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default Sum the first 10 numbers in a 26 cell range

A single-cell formula

=SUM(OFFSET($A$2,0,0,SMALL(IF(A2:A27<"",ROW(A2:A2 7)),10)-1,1))

This is an array formula, and it must be entered with
<Shift<Ctrl<Enter instead of <Enter, also if
edited later.


--
Best Regards
Leo Heuser

Followup to newsgroup only please.

"jester" skrev i en meddelelse
om...
I have to sum the first 10 numbers in a 26 cell range. The problem is
that I do not know which cells the numbers are in. The 26 cells
contain single quotes (') to begin with. The numbers are typed in as
the event occurs. I do not know which cells they will be typed in. I
only want the first 10 numbers to be sumed. This can be a formula or a
macro. The formula is preferred. Thanks in advance.



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
cell column number for the max value of a range of numbers Aline Excel Discussion (Misc queries) 1 February 22nd 07 08:36 AM
Dealing with range of numbers in a cell Penny Excel Worksheet Functions 5 May 4th 06 08:20 PM
sum a range of numbers entered into a cell paphos2006 New Users to Excel 3 March 2nd 06 10:38 PM
Range of numbers in a single cell DRB Excel Discussion (Misc queries) 2 January 12th 06 12:18 AM
occurance of numbers in cell range Dillenger Excel Worksheet Functions 14 February 21st 05 06:45 PM


All times are GMT +1. The time now is 04:47 PM.

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"