There is a mathematical / measurement method to calculate the effective focal length of a lens by measuring its angle of view.
The formula for angle of view is given as
$$ \alpha = 2\arctan{d\over2f} \qquad[1]$$
To calculate effective focal length \$f\$, rearranging equation 1 comes down to:
$$\begin{align}
f &= {d\over 2\tan(\alpha/ 2)} \\
&= {d\over 2}\cot\left({\alpha\over 2}\right)
\end{align}$$
where \$d\$ represents the size of the sensor in the direction measured. \$d\$ would be 24 mm in case you are using a full frame camera.
Let us now have the following setup for measuring \$\alpha\$;

You have a camera sitting at a height \$H\$ from the ground and a distance of \$X\$ from the wall with a scale. Now take a picture and you should be able to read the maximum height the lens can see (this would be \$H + Y\$).
Now knowing \$X\$ and \$Y\$, we can calculate half the angle of view (i.e. \$\alpha/2\$) using a right-triangle calculator (\$X\$ would be the opposite side and \$Y\$ the adjacent side), which uses the formula
$$ {\alpha\over 2} = \arctan{Y\over X} $$
Now that you have figured out \$\alpha/2\$, use it on equation 1 to calculate the effective focal length of the lens.
The value is only accurate as your measurements.
Edit 1:
In reference to @mattdm’s comment: Are the manufacturer-stated sensor dimensions close enough?
With reference to sensor sizes of camera’s in these links: here and here, we can logically assume that camera makers or at least Canon and Nikon round their sensor sizes 1/10 of an mm; i.e. there is a possibility of ±0.05 mm error in case they round the sensor size.
Let us consider 3 type of lenses:
- Wide angle lens (say 13 mm, angle of view: 85.4º)
- Normal lens (50 mm, angle of view 27.0º)
- Telephoto lens (300 mm, angle of view: 4.58º)
The effect of a 0.05 mm change in sensor size are:
change for wide Angle lens = 0.05 / (2 * tan(85.4/2)) = 0.04613 mm appx.
Which represents an difference of 0.35% (i.e. (0.04613 / 13) * 100 )
change for normal lens= 0.05 / (2 * tan(27/2)) = 0.012 mm appx.
Which represents an difference of 0.024% (i.e. (0.012/ 50) * 100 )
change for telephoto lens= 0.05 / (2 * tan(4.58/2)) = 0.0019 mm appx.
Which represents an difference of 0.0006% (i.e. (0.0019/ 300) * 100 )
We can thus see that with a 13mm wide angle lens and taking a 0.05mm error in manufacturers’ measurement, the change in the focal length is only 0.35%.
I hope that my math is correct.
Edit 2:
Regarding measurements for \$X\$ and \$H\$,
- \$H\$ should be measured from ground to the horizontal center of the sensor.
- \$X\$ is the distance between sensor and the wall.