Median for 255+ non-contiguous cell ranges

eelisabeth0910

New Member
Joined
Dec 20, 2022
Messages
4
Office Version
  1. 2019
Platform
  1. Windows
Apologies if this is explained poorly. I have a data set of about 1100 rows each representing a unique individual, and 40 columns. The first 20 or so columns contain raw data of the date and time of day (d/mm/yyyy hh:mm) when certain tasks were completed with column header as task type) and the last 20 or so columns are the results of various calculations among various columns (i.e., column Z = column U-column D, column AB = column F-column E, etc.) in hours:minutes. I set this spreadsheet up way before I realized how extensive the data would become so it's probably not most conducive to what I need but I'm stuck with it for the moment.

I need the medians of these column values based on whether the values fall in a certain range (<12:00, 12:01-24:00, 24:01-36:00, 36:01-48:00, or >48:00). Up until recently I've just used the median formula on hand-selected non-contiguous cell ranges (painstaking but effective) but now my dataset is so large that the formula would contain more than 255 cell ranges and no longer works.

Is there any way to calculate these median values for non-contiguous cells? Ideally without having to sort entire columns so that the cell ranges are contiguous? Apologies for my lack of sophistication here.
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Welcome to the Forum!

Could you use something like this?

ABCDE
1MedianCheck
235.535.5
3
4ValueTime12-24h?
52620:4826
62635:50 
71635:05 
83812:5738
93832:32 
10492:04 
114916:2849
124618:0446
132726:03 
143420:0134
154516:5945
16495:37 
173529:53 
184931:52 
195025:32 
201218:3112
212636:06 
221825:44 
234731:25 
242430:25 
252337:43 
261542:58 
274644:55 
282914:4129
293712:4837
303724:05 
31286:20 
32431:09 
331538:44 
343447:04 
352714:3127
361037:27 
37
Sheet1
Cell Formulas
RangeFormula
C2C2=MEDIAN(IF((C5:C36>0.5)*(C5:C36<=1),B5:B36,""))
E2E2=MEDIAN(E5:E36)
E5:E36E5=IF(AND(C5>0.5,C5<=1),B5,"")
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Possibly... Although I need the value of cells in the time column itself (the values are actually custom formatted as [h]:mm;@). Could that format be one of the hindrances? Thank you for your input! I am trying out these ideas now.
 
Upvote 0
Using your examples it looks like I need to write the logic range as numeric instead of in the custom format -- thanks! This solves a piece of the puzzle.
 
Upvote 0
Like this?

ABCD
1MedianCheck
225:3225:32
3
4TimeNon-zero
520:4820:48
635:5035:50
70:00 
812:5712:57
90:00 
100:00 
110:00 
120:00 
130:00 
140:00 
150:00 
160:00 
170:00 
1831:5231:52
1925:3225:32
2018:3118:31
210:00 
220:00 
2331:2531:25
240:00 
2537:4337:43
260:00 
2744:5544:55
280:00 
290:00 
300:00 
316:206:20
321:091:09
330:00 
340:00 
3514:3114:31
3637:2737:27
37
Sheet1
Cell Formulas
RangeFormula
B2B2=MEDIAN(IF((B5:B36<>0),B5:B36,""))
D2D2=MEDIAN(D5:D36)
D5:D36D5=IF(B5<>0,B5,"")
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0

Forum statistics

Threads
1,223,275
Messages
6,171,127
Members
452,381
Latest member
Nova88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top