The usual thing to do when finding the median of a frequency distribution is to figure out which group contains the median, and then interpolate within that group.
The calculation works like this: With 22 values, the median would normally be the average of the 11th and 12 values. The first two groups contain only up to 9 data values, and adding the third gives 15 of the data values, so the median is in the third (80-90) group.
Now, do interpolation within the 80-90 group. There are 6 data values in this group, and you want the one that falls 11.5 - 9 = 2.5 values in. Take 2.5/6 = 5/12, so the interpolated median is 5/12 of the way through the 80-90 group. Five-twelfths of the way through the 80-90 group is 5/12(10) = 4 1/6 units from the start of the 80-90 group. Thus we need to add the starting value of 80 to 4 1/6 to obtain our interpolated median of 84 1/6.
As a formula, this is
$$L_i + \frac{(n+1)/2 - CF_{i-1}}{F_i}R_i,$$
where
- $i$ is the group containing what would be the median,
- $F_i$ is the number of values (frequency) in group $i$ (6 in your example),
- $R_i$ is the range of values (upper $-$ lower) in group $i$ (10 in your example),
- $L_i$ is the lower end of the range in group $i$ (80 in your example),
- $CF_{i-1}$ is the total number of values (cumulative frequency) of all groups before group $i$ (9 = 4+5 in your example).
Alternative explanation, per request of OP:
I think the (slightly expanded) description above essentially gives the derivation of the formula, but let me provide another way of viewing it.
The interpolation we're doing here is the kind that assumes that the data values in group $i$ are distributed uniformly throughout the group. From a graphical point of view, it means that all the data points in group $i$ fall on a single line. So doing (linear) interpolation here entails finding the equation of the line, and then plugging in the right value. In this case, the $x$ values represent the rankings of the data points when they are placed in order, and $y$ represents the actual values of the data points. The median has an $x$ value of $(n+1)/2$, and we want to find its corresponding $y$ value.
We will use the point-slope form of a line equation. The slope is the change in $y$ divided by the change in $x$. Over group $i$, the change in the actual data values $y$ is $R_i$, the range of group $i$. (In the example this is 90-80 = 10.) The change in $x$ over group $i$ is the number of data points in group $i$, which we call the frequency $F_i$ of group $i$. (In the example this is 6.) So the slope of our line is $R_i/F_i$.
For our point we assume that the last data value before group $i$ occurs at the upper endpoint of group $i-1$. The rank of the last data value before group $i$ is the total number of data values in groups 1, 2, $\ldots, i-1$, which we call $CF_{i-1}$, the cumulative frequency of group $i-1$. The upper endpoint of group $i-1$ is the same as the lower endpoint $L_i$ of group $i$. So we take our point to be $(CF_{i-1}, L_i)$. (In the example this is (4+5,80) = (9,80).)
Substituting all of this into the point-slope form of a line $y = y_1 + m (x - x_1)$ we have $$y = L_i + \frac{R_i}{F_i}(x - CF_{i-1}).$$
Substituting $(n+1)/2$ in for $x$ gives the formula above.