I'm writing VBA code for calculating the Sortino ratio and I ran into a speedbump. There are a ton of different sites all saying different things about how to properly calculate the Sortino ratio. So, when I calculate the downside standard deviation, should I divide the sum of the squares by the total number of observations in the series or just the observations below the minimum acceptable return? My gut wants to just take the observations below the minimum acceptable rate or return and divide by (n-1), since it seems like that would give me a more accurate estimate of the downside volatility. But I want to get an educated opinion....