Hi all, there are many threads that reference this formula or something similar with the goal of emulating the Subtotal behaviour for Median. In my case, specifically I'm wanting the median function to only apply to visible cells when I'm using filters. The formula that I've been using and seems to work well is
Obviously in this example the data range is A2:A500, I was wondering if anyone knows of a user defined function around this formula that will populate the range values based on the user selection like a regular function does? I was thinking something like;
Function MEDIANSUBTOTAL (datarange)
where if I entered "=MEDIANSUBTOTAL(S4:S30)" into my formula bar, the function would perform the operation as though I'd entered
Has anyone already created or found a UDF for this function/purpose?
Thanks,
Joe
Code:
{=MEDIAN(IF(SUBTOTAL(2,OFFSET(A2,ROW(A2:A500)-ROW(A2),0)),A2:A500))}
Obviously in this example the data range is A2:A500, I was wondering if anyone knows of a user defined function around this formula that will populate the range values based on the user selection like a regular function does? I was thinking something like;
Function MEDIANSUBTOTAL (datarange)
where if I entered "=MEDIANSUBTOTAL(S4:S30)" into my formula bar, the function would perform the operation as though I'd entered
Code:
{=MEDIAN(IF(SUBTOTAL(2,OFFSET(S4,ROW(S4:S30)-ROW(S4),0)),S4:S30))}
Has anyone already created or found a UDF for this function/purpose?
Thanks,
Joe