Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 806
Default How do I sum up random cells

Hello,

You might want to sum from the smallest column and row index up to the
highest (SUM(A2:G7)) if no other "unwanted" numbers appear in that
area.

Or you mark all wanted cells with a special number format (currency
different from other numbers, for example) and you sum by that format
condition, for example with a UDF such as:
Function smf(r As Range)
'Sum my format: sums up all values in r which have
'the same format as calling cell (where this
'function is called from).
Dim v

With Application.Caller
For Each v In r
If v.NumberFormat = .NumberFormat Then
smf = smf + v
End If
Next v
End With

End Function

Or you mark them with a special background colour and sum by that
(http://www.ozgrid.com/VBA/sum-count-cells-by-color.htm).

If you cannot separate wanted numbers from unwanted ones
("include" (=specify) your wanted numbers or "exclude" unwanted ones)
this will be difficult :-)

Regards,
Bernd
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 109
Default How do I sum up random cells

Josh

Another approach would be to click on all the cells you want to sum
and assign those discontiguous cells a name (insert names define) like
"sumcells". Then your formula could be simple, =sum(sumcells).

Implementation of this approach could possibly be simplified if the
cells to be summed have a common feature that would allow you to
select them all at once using goto special. For example if you are
summing all the cells that contain formulas in a range and only those,
you would highlight the range, use GoTo (F5) Special then formulas.
The cells would all be selected, you then insert your range name. The
simple formla =sum(sumcells) would work.

Good luck.

Ken
Norfolk, Va




On Apr 25, 4:25*am, Bernd P wrote:
Hello,

You might want to sum from the smallest column and row index up to the
highest (SUM(A2:G7)) if no other "unwanted" numbers appear in that
area.

Or you mark all wanted cells with a special number format (currency
different from other numbers, for example) and you sum by that format
condition, for example with a UDF such as:
Function smf(r As Range)
'Sum my format: sums up all values in r which have
'the same format as calling cell (where this
'function is called from).
Dim v

With Application.Caller
For Each v In r
* * If v.NumberFormat = .NumberFormat Then
* * * * smf = smf + v
* * End If
Next v
End With

End Function

Or you mark them with a special background colour and sum by that
(http://www.ozgrid.com/VBA/sum-count-cells-by-color.htm).

If you cannot separate wanted numbers from unwanted ones
("include" (=specify) your wanted numbers or "exclude" unwanted ones)
this will be difficult :-)

Regards,
Bernd


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 55
Default How do I sum up random cells

I will have to work a little on those functions. The background colour tip is
a great one! Thanks

"Bernd P" wrote:

Hello,

You might want to sum from the smallest column and row index up to the
highest (SUM(A2:G7)) if no other "unwanted" numbers appear in that
area.

Or you mark all wanted cells with a special number format (currency
different from other numbers, for example) and you sum by that format
condition, for example with a UDF such as:
Function smf(r As Range)
'Sum my format: sums up all values in r which have
'the same format as calling cell (where this
'function is called from).
Dim v

With Application.Caller
For Each v In r
If v.NumberFormat = .NumberFormat Then
smf = smf + v
End If
Next v
End With

End Function

Or you mark them with a special background colour and sum by that
(http://www.ozgrid.com/VBA/sum-count-cells-by-color.htm).

If you cannot separate wanted numbers from unwanted ones
("include" (=specify) your wanted numbers or "exclude" unwanted ones)
this will be difficult :-)

Regards,
Bernd

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
is it possible for excel to take several cells in random order and confused in Iowa Excel Discussion (Misc queries) 1 January 7th 08 03:17 AM
Random selection of text cells CJ Excel Discussion (Misc queries) 3 September 10th 06 07:05 AM
(djn) Excel Not Updating Random Cells djn Excel Discussion (Misc queries) 1 May 18th 06 08:15 PM
Sum of random cells with positive data Susannah Excel Discussion (Misc queries) 2 February 18th 05 10:28 AM
random selection from a range of cells tjb Excel Worksheet Functions 1 February 15th 05 06:34 PM


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