Just say IF BLANK then X, if Not BLANK, do Y. Then check for X and Y and fill either /or.

Should be able to do it in 2-3 IF statements. Create a BOOLEAN or two.