Just nest it inside an IF statement like so
=IF(D9<>"",IF(E9=TRUE,VLOOKUP(J5,'GLASS-MAT'!$A$22:$I$36,9,TRUE),0)+IF(E9=FALSE,VLOOKUP(J5,'GLASS-MAT'!$A$22:$D$36,4,TRUE),0),0)
I also removed the "" from around your zeros as that just changes the number 0 to the text 0. Not sure you want that.
Bookmarks