Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 193
Default How to calculate Min,Median,Max values in non consecutive rows via

Hi,

I would like to calculate the Min, Median and Max values in non consecutive
rows via VBA.

Year Value
2007 10
2007 20
2008 11
2009 12
2007 30
2008 25
2009 55
2008 26
2008 16
2009 40

I would like to represent the results as follows:

2007 Min = xxx
Median = xxx
Max = xxx

2008 Min = xxx
Median = xxx
Max = xxx

2009 Min = xxx
Median = xxx
Max = xxx

Any idea what my code would look like?

Pete.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default How to calculate Min,Median,Max values in non consecutive rows via

You can calculate your statistics (even non-consecutive) without any VBA:

=MAX(IF(A1:A10=2007,B1:B10,""))
=MIN(IF(A1:A10=2007,B1:B10,""))
=MEDIAN(IF(A1:A10=2007,B1:B10,""))

and will display:

30
10
20


These are array formulae. They must be entered with CNTRL-SHFT-ENTER rather
than just the ENTER key.

If you must use VBA, then use it to insert the equations!
--
Gary''s Student - gsnu200844


"Pete" wrote:

Hi,

I would like to calculate the Min, Median and Max values in non consecutive
rows via VBA.

Year Value
2007 10
2007 20
2008 11
2009 12
2007 30
2008 25
2009 55
2008 26
2008 16
2009 40

I would like to represent the results as follows:

2007 Min = xxx
Median = xxx
Max = xxx

2008 Min = xxx
Median = xxx
Max = xxx

2009 Min = xxx
Median = xxx
Max = xxx

Any idea what my code would look like?

Pete.

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
Transposing data from consecutive rows into non-consecutive rows econ Excel Discussion (Misc queries) 0 March 10th 08 07:24 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 median for different groups Daniel Excel Discussion (Misc queries) 2 January 26th 05 12:17 PM
Calculate top 100 values in non-consecutive rows ZermaPersians Excel Programming 3 September 7th 03 08:12 PM


All times are GMT +1. The time now is 09:09 AM.

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"