Let's consider the following example:
One has measured the force necessary to extend a spring from its rest (equilibrium position) for various extensions. The goal is to find the spring constant. The theory (Hook's Law) predicts the linear dependence between the force and the change of the length of the spring:
F = -kx
To find the spring constant k, one needs to plot the negative force -F as a function of x and find the straight-line fit. The slope of that line is equal to the spring constant k.
Finding the best straight-line fit could be quite time consuming if done with a calculator. Using Microsoft Excel program significantly simplifies the whole procedure. Follow the steps shown below to make a graph and then draw a straight line that fits your data.




Now we can see the straight line of the fit, but we do not know what the parameters of the equation are. To show the equation, click on "Trendline" and select "More Trendline Options..." Then check the "Display Equation on chart" box.

The final result should look similar to the example shown below.

From the equation for that straight line (y = 19.486x -0.002) we can conclude that the best estimate of the spring constant is: k = 19.49 (N/m), where 19.49 (N/m) is the slope of the line and -0.002 (N/m) represents the y-intercept.
MS Excel can be also used to fit more complicated equations (e.g., polynomial, exponential, logarithmic, etc.) using the same procedure, but with different trendline options - "More Trendline Options..."