In D2 and copied down,

=LEN(B2)>0

Now use;

=CONCATIFS(C2:C11,";",D2:D11,TRUE)