Which standard deviation formula would I use and where?
The second formula you have is the general formula that you use in situations where you have information on every data point. The first formula, assuming that f is a frequency, is an *approximate* formula if you have already grouped the data in a table. The xi are then not the individual data points, but the midpoints of each grouping. So, for example, if you had x values 1.2, 2.5, 1.7, 3.4, 5.6, etc. you could use the exact formula. But if you were given a table like 1-2 4 2-3 10 3-4 6 4-5 1 5-6 11 then, since you don’t have the individual data points, you have to work with the approximate formula.