How to use if/else statements to calculate values?

I did find this post that worked perfectly for me