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

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Calculate Median with a macro

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.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Calculate Median with a macro

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.




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

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.






  #5   Report Post  
Posted to microsoft.public.excel.programming
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.






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
How do I calculate a weighted median? ac Excel Worksheet Functions 7 April 3rd 23 06:46 PM
How do I calculate the median of a distribution? hello Excel Discussion (Misc queries) 4 March 2nd 07 09:44 AM
Calculate MEDIAN of Last x Rows in a Column Sam via OfficeKB.com Excel Worksheet Functions 6 November 26th 06 06:22 PM
calculate a MEDIAN using multiple criteria? MetricsShiva Excel Worksheet Functions 0 August 19th 05 04:39 PM
Calculate median for different groups Daniel Excel Discussion (Misc queries) 2 January 26th 05 12:17 PM


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