5:1 is the ratio of raisin cookies to oatmeal cookies, and 40 raisin cookies were sold. Meaning, 40:?.
To find the number of oatmeal cookies you divide 40 by 5, which gets 8. This means that the original ratio is multiplied by 8 to get the current ratio for the amount if cookies. 5(8) : 1(8) = 40:8. There are 40 raisin cookies and 8 oatmeal cookies. 40+8=48. There were 48 cookies sold in total.