You need to type carefully, but I'd have thought that the formula:
=IF(B1="Referral",0.2*A1,"")
would be as close as you can get. This works in LibreOffice, so probably will work in excel too. There are in the formula above two adjacent speechmarks -- you could insert a space between them, or not, but the output generated is:
50 Referral 10
12 blahbla
10 Referral 2
For example.