Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
fl fl is offline
external usenet poster
 
Posts: 10
Default How to loop through the data to find the median?

I have the following spreadsheet. I would like to find the median for
Column B for the associated item in A. For example, for Item 1, get
median(B1:B12); for Item 2, median(B13:B17); Item 3, median(b18:b20)
etc. Is there an example to do this using VBA? Thanks.

A B
= ====
1 1 154000
2 1 556000
3 1 195000
4 1 135000
5 1 154500
6 1 109896
7 1 172000
8 1 250000
9 1 162500
10 1 120000
11 1 100000
12 1 125000
13 2 126000
14 2 167565
15 2 125000
16 2 150000
17 2 90000
18 3 128648
19 3 148740
20 3 125000
21 4 104280
22 4 71500
23 4 109555
24 4 121000
25 4 132720
26 4 114600
27 4 84150


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 136
Default How to loop through the data to find the median?

You could do this with an array formula:
In C1 enter the value in column A you want to find the median of column B
In D1 enter the following array formula: =MEDIAN(IF(A1:A27=C1,B1:B27,FALSE))
The array formula must be entered with ctrl+shift+enter.

fl wrote:
I have the following spreadsheet. I would like to find the median for
Column B for the associated item in A. For example, for Item 1, get
median(B1:B12); for Item 2, median(B13:B17); Item 3, median(b18:b20)
etc. Is there an example to do this using VBA? Thanks.

A B
= ====
1 1 154000
2 1 556000
3 1 195000
4 1 135000
5 1 154500
6 1 109896
7 1 172000
8 1 250000
9 1 162500
10 1 120000
11 1 100000
12 1 125000
13 2 126000
14 2 167565
15 2 125000
16 2 150000
17 2 90000
18 3 128648
19 3 148740
20 3 125000
21 4 104280
22 4 71500
23 4 109555
24 4 121000
25 4 132720
26 4 114600
27 4 84150


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 can I find a median? lisab Excel Discussion (Misc queries) 16 December 5th 09 01:16 AM
Find loop doesn't loop JSnow Excel Discussion (Misc queries) 2 June 24th 09 08:28 PM
find for non zero values in a column Median,Mode,STDEV Billp Excel Worksheet Functions 2 June 24th 09 03:20 PM
Find the median 3 values Horatio J. Bilge, Jr. Excel Discussion (Misc queries) 6 November 20th 07 07:13 PM
Find Median of Positive numbers only in Range MichaelC Excel Worksheet Functions 4 June 24th 05 03:06 AM


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