I have information on three different sheets.

On one sheet I have a list of products, identified by a product number. This sheet contains a products price.

On a second sheet I have purchase orders, also identified by a bill number, this sheet indicates what products have been ordered and what amount of the product was ordered.

On a third sheet I have billing numbers and an empty column where the total cost of the bill will go.

I need to multiply the number of products ordered (product number and amount ordered on sheet 2) by the cost of the product (product number and cost on sheet 1). These amounts then need to be summed together if they are a part of the same bill.

A B
drug_id whole_sale_price
1 1.95
2 2.25

A B C
bill_no drug_id units_purchased
1 1 1000
1 2 500

A B
bill_no cost
1