google sheets – Find the previous non-blank value from a column using a value in an adjacent column as search key

Assuming that invoices and models are in A2:B, you can look up the first matching invoice for the model in cell E2 like this:

=arrayformula( 
  iferror( 
    vlookup( 
      E2, 
      { 
        B2:B, 
        iferror( 
          vlookup( 
            row(A2:A), 
            if( len(A2:A), { row(A2:A), A2:A } ), 
            2, 
            true 
          ) 
        ) 
      }, 
      2, 
      false  
    ) 
  ) 
)

To look up the first matching invoice for a whole column of models in E2:E, replace E2 with E2:E in the formula.