So the work function gives the minimum energy required from a photon to knock an electron out of the surface of a metal.
Say we know the velocity of the electron once ejected, or we know the kinetic energy of the electron.
Say we also know the frequency of the photons that we aimed at the metal. Then the energy of the photon that ejected the electron is $hf$, where $h$ is Planck's constant and $f$ is the frequency of the incident photon.
Well then it follows that the difference between the energy of the photon and the kinetic energy of the electron (i.e. the amount of energy that the photon transferred to the electron) will of course be the work function. In mathematical terms, $$\phi=hf-K,$$ where $\phi$ is the work function and $K$ is the kinetic energy of the electron. Thus the work function has been calculated without having to know the threshold frequency.