Try this in D4
Drag/Fill Down![]()
=IF(OR(E4=0,E4=1),IF(G4<>"",G4*IF(E4=1,$B$1,IF(E4=0,$D$1,0)),INDEX($G$4:$G4,MATCH(999^9,$G$4:$G4,1),1)*IF(E4=1,$B$1,IF(E4=0,$D$1,0))),"")
Note
You have empty strings in Column G, these will have to be cleaned before this will work
Bookmarks