View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
K McCurry[_2_] K McCurry[_2_] is offline
external usenet poster
 
Posts: 4
Default Calculate Median with a macro

Yes that would be correct. It would need to calculate the median for each
row in column M. I will give what you sent a try. Hope that helps. Thanks.

"Tom Ogilvy" wrote:

do you mean you want the meadian for the values in each row in columns C to
K, then entered in the corresponding cell in column M?

Sub ComputeMedian()
set rng = Range(cells(2,3),cells(rows.count,3).End(xlup)
for each cell in rng
cell.offset(0,10) = application.Median(cell.resize(1,9))
Next
End Sub

--
Regards,
Tom Ogilvy

"K McCurry" wrote in message
...
Thanks for responding. How would use that command to calulate the median

if
you did not know how many records would be in the file? The median will

be
in column M and the range I am using will be C - K. I would like to run a
macro for this. Thanks.


"Tom Ogilvy" wrote:

Application.Median(Range("C1:J100"))

--
Regards,
Tom Ogilvy

"K McCurry" wrote in message
...
How do I set up a macro to calulate Medain? The median will be in in

its
own
column which is col K and the data will be cols c through J. Also the
data
could be off any size (could many records). Thanks.