You need to insert the ELSE statement for each IF. For example, if the first IF is not true, the code never gets to the ELSE ...=0