I usually test my formulas in Excel. The syntax is the same; if it works in Excel, it’s going to work in SharePoint. (There may be exceptions to this, but I haven’t run into them.)
Simply set up some cells with the values you need and then work out your formula. Once you’ve got it working the way you want it, copy it over to your calculated column and replace the cell references with column names (in brackets).