Heuristic expressions for the inductance of a finite-length solenoid The expression for the inductance of a very long solenoid is
$$L = \frac{\mu_0 N^2(\pi r^2)}{l}$$
where $l$, $r$ and $N$ are the length, radius and number of turns respectively. Things get much trickier if we don't make the approximation that the solenoid is very long. Computing the on-axis field is still tractable. However computing the inductance requires knowledge of the off-axis field, and while expressions for that exist (see this post), they're quite ugly. So you're probably stuck doing numerical calculations if you want to use them to compute the inductance.
But what if all we want is a very rough estimate for the inductance? An approximate but human-readable formula that shows how inductance scales with length would probably be more useful than a crazy analytic expression involving elliptic integrals anyway. Such a formula would be perfectly useful if it were extracted empirically by fitting numerical data, and it would only need to depend nontrivially on the coil's aspect ratio $l/r$. Does such a formula exist? Given how common solenoids are and how rare infinitely long solenoids are, it seems reasonably likely that this formula is in common use somewhere.
 A: Let's assume that the coil is tightly wound and wire thickness is negligible, so that we can think of the solenoid as a sheet of current rotating about the solenoid's axis. The most common estimate is probably Wheeler's formula. Let's define $L_0 = \mu_0 N^2(\pi r^2)/l$, which is the usual expression for a solenoid's inductance when $l \gg r$. As noted in the question, we should be able to write a correction to this formula that only depends on the ratio $r/l$. This correction factor is called the Nagaoka coefficient $k_L$
$$L_\text{actual} = L_0 k_L$$
which asymptotes to $k_L = 1$ in the limit of large $l$, and takes a value of $0.688423...$ for a 'square' solenoid ($r=l/2$). If $l \geq 0.8 r$, Wheeler's expression for $k_L$ is accurate to within 0.32%.
$$k_L \approx \frac{1}{1+0.9004 (r/l)}, ~~~~~~~ l\geq 0.8 r$$
Lots of online calculators use this formula, though its fractional error increases above 20% for $l/r < 0.2$ and grows from there. People have worked out many expressions to increase the accuracy, tons of which can be found in this document. Here's one that maintains a fractional error below 1.63% for all $l$ and $r$
$$k_L \approx \frac{l}{\pi r}\left[ k \ln\left(1+\frac{\pi r}{l}\right) + (1-k)\text{asinh}\left(\frac{\pi r}{l}\right) \right]$$
where $k = 0.482$.
Remarkably, the short-solenoid problem also admits an exact solution
$$k_L = \frac{8r}{3\pi l}\left[ \frac{2\kappa^2-1}{\kappa^3}E(\kappa^2) + \frac{1-\kappa^2}{\kappa^3}K(\kappa^2) - 1\right], ~~~~~~ \kappa = \frac{1}{\sqrt{1+(l/2r)^2}}$$
where $K$ and $E$ are the first and second complete elliptic functions. I've written these expressions using the same convention for the elliptic functions that Mathematica and Matlab use, but note that many sources would replace $E(\kappa^2) \rightarrow E(\kappa)$ and $K(\kappa^2) \rightarrow K(\kappa)$.
It's possible to go way way beyond the approximations used here, to include the effect of wire thickness, finite wire spacing and lots of high frequency effects. The document linked above is well-written and has basically everything.
